comparison vp8.c @ 12228:9c63566f623f libavcodec

Eliminate some repeated dereferences in VP8 inter_predict
author darkshikari
date Thu, 22 Jul 2010 21:05:30 +0000
parents c3e11b3108d7
children cf675a4d5195
comparison
equal deleted inserted replaced
12227:d07e6037846d 12228:9c63566f623f
1100 static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, 1100 static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
1101 int mb_x, int mb_y) 1101 int mb_x, int mb_y)
1102 { 1102 {
1103 int x_off = mb_x << 4, y_off = mb_y << 4; 1103 int x_off = mb_x << 4, y_off = mb_y << 4;
1104 int width = 16*s->mb_width, height = 16*s->mb_height; 1104 int width = 16*s->mb_width, height = 16*s->mb_height;
1105 AVFrame *ref = s->framep[mb->ref_frame];
1106 VP56mv *bmv = mb->bmv;
1105 1107
1106 prefetch_motion(s, mb, mb_x, mb_y, x_off, y_off, VP56_FRAME_PREVIOUS); 1108 prefetch_motion(s, mb, mb_x, mb_y, x_off, y_off, VP56_FRAME_PREVIOUS);
1107 1109
1108 if (mb->mode < VP8_MVMODE_SPLIT) { 1110 if (mb->mode < VP8_MVMODE_SPLIT) {
1109 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1111 vp8_mc_part(s, dst, ref, x_off, y_off,
1110 0, 0, 16, 16, width, height, &mb->mv); 1112 0, 0, 16, 16, width, height, &mb->mv);
1111 } else switch (mb->partitioning) { 1113 } else switch (mb->partitioning) {
1112 case VP8_SPLITMVMODE_4x4: { 1114 case VP8_SPLITMVMODE_4x4: {
1113 int x, y; 1115 int x, y;
1114 VP56mv uvmv; 1116 VP56mv uvmv;
1115 1117
1116 /* Y */ 1118 /* Y */
1117 for (y = 0; y < 4; y++) { 1119 for (y = 0; y < 4; y++) {
1118 for (x = 0; x < 4; x++) { 1120 for (x = 0; x < 4; x++) {
1119 vp8_mc(s, 1, dst[0] + 4*y*s->linesize + x*4, 1121 vp8_mc(s, 1, dst[0] + 4*y*s->linesize + x*4,
1120 s->framep[mb->ref_frame]->data[0], &mb->bmv[4*y + x], 1122 ref->data[0], &bmv[4*y + x],
1121 4*x + x_off, 4*y + y_off, 4, 4, 1123 4*x + x_off, 4*y + y_off, 4, 4,
1122 width, height, s->linesize, 1124 width, height, s->linesize,
1123 s->put_pixels_tab[2]); 1125 s->put_pixels_tab[2]);
1124 } 1126 }
1125 } 1127 }
1141 if (s->profile == 3) { 1143 if (s->profile == 3) {
1142 uvmv.x &= ~7; 1144 uvmv.x &= ~7;
1143 uvmv.y &= ~7; 1145 uvmv.y &= ~7;
1144 } 1146 }
1145 vp8_mc(s, 0, dst[1] + 4*y*s->uvlinesize + x*4, 1147 vp8_mc(s, 0, dst[1] + 4*y*s->uvlinesize + x*4,
1146 s->framep[mb->ref_frame]->data[1], &uvmv, 1148 ref->data[1], &uvmv,
1147 4*x + x_off, 4*y + y_off, 4, 4, 1149 4*x + x_off, 4*y + y_off, 4, 4,
1148 width, height, s->uvlinesize, 1150 width, height, s->uvlinesize,
1149 s->put_pixels_tab[2]); 1151 s->put_pixels_tab[2]);
1150 vp8_mc(s, 0, dst[2] + 4*y*s->uvlinesize + x*4, 1152 vp8_mc(s, 0, dst[2] + 4*y*s->uvlinesize + x*4,
1151 s->framep[mb->ref_frame]->data[2], &uvmv, 1153 ref->data[2], &uvmv,
1152 4*x + x_off, 4*y + y_off, 4, 4, 1154 4*x + x_off, 4*y + y_off, 4, 4,
1153 width, height, s->uvlinesize, 1155 width, height, s->uvlinesize,
1154 s->put_pixels_tab[2]); 1156 s->put_pixels_tab[2]);
1155 } 1157 }
1156 } 1158 }
1157 break; 1159 break;
1158 } 1160 }
1159 case VP8_SPLITMVMODE_16x8: 1161 case VP8_SPLITMVMODE_16x8:
1160 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1162 vp8_mc_part(s, dst, ref, x_off, y_off,
1161 0, 0, 16, 8, width, height, &mb->bmv[0]); 1163 0, 0, 16, 8, width, height, &bmv[0]);
1162 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1164 vp8_mc_part(s, dst, ref, x_off, y_off,
1163 0, 8, 16, 8, width, height, &mb->bmv[1]); 1165 0, 8, 16, 8, width, height, &bmv[1]);
1164 break; 1166 break;
1165 case VP8_SPLITMVMODE_8x16: 1167 case VP8_SPLITMVMODE_8x16:
1166 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1168 vp8_mc_part(s, dst, ref, x_off, y_off,
1167 0, 0, 8, 16, width, height, &mb->bmv[0]); 1169 0, 0, 8, 16, width, height, &bmv[0]);
1168 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1170 vp8_mc_part(s, dst, ref, x_off, y_off,
1169 8, 0, 8, 16, width, height, &mb->bmv[1]); 1171 8, 0, 8, 16, width, height, &bmv[1]);
1170 break; 1172 break;
1171 case VP8_SPLITMVMODE_8x8: 1173 case VP8_SPLITMVMODE_8x8:
1172 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1174 vp8_mc_part(s, dst, ref, x_off, y_off,
1173 0, 0, 8, 8, width, height, &mb->bmv[0]); 1175 0, 0, 8, 8, width, height, &bmv[0]);
1174 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1176 vp8_mc_part(s, dst, ref, x_off, y_off,
1175 8, 0, 8, 8, width, height, &mb->bmv[1]); 1177 8, 0, 8, 8, width, height, &bmv[1]);
1176 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1178 vp8_mc_part(s, dst, ref, x_off, y_off,
1177 0, 8, 8, 8, width, height, &mb->bmv[2]); 1179 0, 8, 8, 8, width, height, &bmv[2]);
1178 vp8_mc_part(s, dst, s->framep[mb->ref_frame], x_off, y_off, 1180 vp8_mc_part(s, dst, ref, x_off, y_off,
1179 8, 8, 8, 8, width, height, &mb->bmv[3]); 1181 8, 8, 8, 8, width, height, &bmv[3]);
1180 break; 1182 break;
1181 } 1183 }
1182 1184
1183 prefetch_motion(s, mb, mb_x, mb_y, x_off, y_off, VP56_FRAME_GOLDEN); 1185 prefetch_motion(s, mb, mb_x, mb_y, x_off, y_off, VP56_FRAME_GOLDEN);
1184 } 1186 }