comparison mpegvideo.c @ 266:252444e5259b libavcodec

optimization
author michaelni
date Fri, 15 Mar 2002 14:57:17 +0000
parents 4e9e728021d8
children 09ae29b27ed9
comparison
equal deleted inserted replaced
265:4e9e728021d8 266:252444e5259b
1121 } 1121 }
1122 } 1122 }
1123 1123
1124 s->avg_mb_var = s->avg_mb_var / s->mb_num; 1124 s->avg_mb_var = s->avg_mb_var / s->mb_num;
1125 1125
1126 s->block_wrap[0]=
1127 s->block_wrap[1]=
1128 s->block_wrap[2]=
1129 s->block_wrap[3]= s->mb_width*2 + 2;
1130 s->block_wrap[4]=
1131 s->block_wrap[5]= s->mb_width + 2;
1126 for(mb_y=0; mb_y < s->mb_height; mb_y++) { 1132 for(mb_y=0; mb_y < s->mb_height; mb_y++) {
1127 /* Put GOB header based on RTP MTU */ 1133 /* Put GOB header based on RTP MTU */
1128 /* TODO: Put all this stuff in a separate generic function */ 1134 /* TODO: Put all this stuff in a separate generic function */
1129 if (s->rtp_mode) { 1135 if (s->rtp_mode) {
1130 if (!mb_y) { 1136 if (!mb_y) {
1136 s->first_gob_line = 1; 1142 s->first_gob_line = 1;
1137 } 1143 }
1138 } 1144 }
1139 } 1145 }
1140 1146
1147 s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1;
1148 s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1);
1149 s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1;
1150 s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2);
1151 s->block_index[4]= s->block_wrap[4]*(mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2);
1152 s->block_index[5]= s->block_wrap[4]*(mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2);
1141 for(mb_x=0; mb_x < s->mb_width; mb_x++) { 1153 for(mb_x=0; mb_x < s->mb_width; mb_x++) {
1142 1154
1143 s->mb_x = mb_x; 1155 s->mb_x = mb_x;
1144 s->mb_y = mb_y; 1156 s->mb_y = mb_y;
1157 s->block_index[0]+=2;
1158 s->block_index[1]+=2;
1159 s->block_index[2]+=2;
1160 s->block_index[3]+=2;
1161 s->block_index[4]++;
1162 s->block_index[5]++;
1145 #if 0 1163 #if 0
1146 /* compute motion vector and macro block type (intra or non intra) */ 1164 /* compute motion vector and macro block type (intra or non intra) */
1147 motion_x = 0; 1165 motion_x = 0;
1148 motion_y = 0; 1166 motion_y = 0;
1149 if (s->pict_type == P_TYPE) { 1167 if (s->pict_type == P_TYPE) {