Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: BBB
previous patch reviewed by jason
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -717,6 +717,8 @@ following image formats are supported: |
717 | 717 |
@tab fourcc: VP50 |
718 | 718 |
@item On2 VP6 @tab @tab X |
719 | 719 |
@tab fourcc: VP60,VP61,VP62 |
720 |
+@item On2 VP7 @tab @tab X |
|
721 |
+ @tab fourcc: VP70,VP71 |
|
720 | 722 |
@item VP8 @tab E @tab X |
721 | 723 |
@tab fourcc: VP80, encoding supported through external library libvpx |
722 | 724 |
@item VP9 @tab E @tab X |
... | ... |
@@ -466,6 +466,7 @@ OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56dsp.o \ |
466 | 466 |
vp56rac.o |
467 | 467 |
OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o vp56dsp.o \ |
468 | 468 |
vp6dsp.o vp56rac.o |
469 |
+OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp8dsp.o vp56rac.o |
|
469 | 470 |
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8dsp.o vp56rac.o |
470 | 471 |
OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o |
471 | 472 |
OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o |
... | ... |
@@ -292,6 +292,7 @@ void avcodec_register_all(void) |
292 | 292 |
REGISTER_DECODER(VP6, vp6); |
293 | 293 |
REGISTER_DECODER(VP6A, vp6a); |
294 | 294 |
REGISTER_DECODER(VP6F, vp6f); |
295 |
+ REGISTER_DECODER(VP7, vp7); |
|
295 | 296 |
REGISTER_DECODER(VP8, vp8); |
296 | 297 |
REGISTER_DECODER(VP9, vp9); |
297 | 298 |
REGISTER_DECODER(VQA, vqa); |
... | ... |
@@ -57,10 +57,10 @@ static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, |
57 | 57 |
if(chroma_format_idc == 1){ |
58 | 58 |
h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon; |
59 | 59 |
h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon; |
60 |
- if (codec_id != AV_CODEC_ID_VP8) |
|
60 |
+ if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) |
|
61 | 61 |
h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon; |
62 | 62 |
h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon; |
63 |
- if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8) { |
|
63 |
+ if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) { |
|
64 | 64 |
h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon; |
65 | 65 |
h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon; |
66 | 66 |
h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon; |
... | ... |
@@ -77,7 +77,7 @@ static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, |
77 | 77 |
h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon; |
78 | 78 |
h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon; |
79 | 79 |
h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon; |
80 |
- if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8) |
|
80 |
+ if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) |
|
81 | 81 |
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon; |
82 | 82 |
#endif // HAVE_NEON |
83 | 83 |
} |
... | ... |
@@ -26,7 +26,7 @@ |
26 | 26 |
#include "libavcodec/vp8.h" |
27 | 27 |
|
28 | 28 |
#if HAVE_ARMV6_EXTERNAL |
29 |
-#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6 |
|
29 |
+#define vp8_decode_block_coeffs_internal ff_decode_block_coeffs_armv6 |
|
30 | 30 |
int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, int16_t block[16], |
31 | 31 |
uint8_t probs[8][3][NUM_DCT_TOKENS-1], |
32 | 32 |
int i, uint8_t *token_prob, int16_t qmul[2]); |
... | ... |
@@ -314,6 +314,7 @@ enum AVCodecID { |
314 | 314 |
AV_CODEC_ID_SMVJPEG = MKBETAG('S','M','V','J'), |
315 | 315 |
AV_CODEC_ID_HEVC = MKBETAG('H','2','6','5'), |
316 | 316 |
#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC |
317 |
+ AV_CODEC_ID_VP7 = MKBETAG('V','P','7','0'), |
|
317 | 318 |
|
318 | 319 |
/* various PCM "codecs" */ |
319 | 320 |
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs |
... | ... |
@@ -1241,6 +1241,13 @@ static const AVCodecDescriptor codec_descriptors[] = { |
1241 | 1241 |
.long_name = NULL_IF_CONFIG_SMALL("Mirillis FIC"), |
1242 | 1242 |
.props = AV_CODEC_PROP_LOSSY, |
1243 | 1243 |
}, |
1244 |
+ { |
|
1245 |
+ .id = AV_CODEC_ID_VP7, |
|
1246 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
1247 |
+ .name = "vp7", |
|
1248 |
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP7"), |
|
1249 |
+ .props = AV_CODEC_PROP_LOSSY, |
|
1250 |
+ }, |
|
1244 | 1251 |
|
1245 | 1252 |
/* image codecs */ |
1246 | 1253 |
{ |
... | ... |
@@ -420,7 +420,7 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
420 | 420 |
|
421 | 421 |
#define H264_PRED(depth) \ |
422 | 422 |
if(codec_id != AV_CODEC_ID_RV40){\ |
423 |
- if(codec_id == AV_CODEC_ID_VP8) {\ |
|
423 |
+ if(codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\ |
|
424 | 424 |
h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\ |
425 | 425 |
h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\ |
426 | 426 |
} else {\ |
... | ... |
@@ -435,15 +435,14 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
435 | 435 |
h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ |
436 | 436 |
h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ |
437 | 437 |
h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ |
438 |
- if (codec_id == AV_CODEC_ID_VP8) {\ |
|
438 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\ |
|
439 | 439 |
h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\ |
440 | 440 |
} else\ |
441 | 441 |
h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\ |
442 | 442 |
h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\ |
443 |
- if(codec_id != AV_CODEC_ID_VP8) {\ |
|
443 |
+ if(codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) {\ |
|
444 | 444 |
h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ |
445 | 445 |
h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ |
446 |
- h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ |
|
447 | 446 |
} else {\ |
448 | 447 |
h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\ |
449 | 448 |
h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\ |
... | ... |
@@ -451,6 +450,8 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
451 | 451 |
h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\ |
452 | 452 |
h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\ |
453 | 453 |
}\ |
454 |
+ if (codec_id != AV_CODEC_ID_VP8)\ |
|
455 |
+ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ |
|
454 | 456 |
}else{\ |
455 | 457 |
h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ |
456 | 458 |
h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ |
... | ... |
@@ -489,7 +490,7 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
489 | 489 |
h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\ |
490 | 490 |
h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\ |
491 | 491 |
}\ |
492 |
- if (codec_id != AV_CODEC_ID_VP8) {\ |
|
492 |
+ if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) {\ |
|
493 | 493 |
if (chroma_format_idc <= 1) {\ |
494 | 494 |
h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\ |
495 | 495 |
} else {\ |
... | ... |
@@ -497,7 +498,7 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
497 | 497 |
}\ |
498 | 498 |
} else\ |
499 | 499 |
h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\ |
500 |
- if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\ |
|
500 |
+ if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8){\ |
|
501 | 501 |
if (chroma_format_idc <= 1) {\ |
502 | 502 |
h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ |
503 | 503 |
h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ |
... | ... |
@@ -519,7 +520,7 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
519 | 519 |
h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\ |
520 | 520 |
h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\ |
521 | 521 |
h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\ |
522 |
- if (codec_id == AV_CODEC_ID_VP8) {\ |
|
522 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\ |
|
523 | 523 |
h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\ |
524 | 524 |
h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\ |
525 | 525 |
}\ |
... | ... |
@@ -540,6 +541,7 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, |
540 | 540 |
case AV_CODEC_ID_RV40:\ |
541 | 541 |
h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\ |
542 | 542 |
break;\ |
543 |
+ case AV_CODEC_ID_VP7:\ |
|
543 | 544 |
case AV_CODEC_ID_VP8:\ |
544 | 545 |
h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\ |
545 | 546 |
h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\ |
... | ... |
@@ -1,10 +1,11 @@ |
1 | 1 |
/* |
2 |
- * VP8 compatible video decoder |
|
2 |
+ * VP7/VP8 compatible video decoder |
|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2010 David Conrad |
5 | 5 |
* Copyright (C) 2010 Ronald S. Bultje |
6 | 6 |
* Copyright (C) 2010 Jason Garrett-Glaser |
7 | 7 |
* Copyright (C) 2012 Daniel Kang |
8 |
+ * Copyright (C) 2014 Peter Ross |
|
8 | 9 |
* |
9 | 10 |
* This file is part of FFmpeg. |
10 | 11 |
* |
... | ... |
@@ -35,6 +36,14 @@ |
35 | 35 |
# include "arm/vp8.h" |
36 | 36 |
#endif |
37 | 37 |
|
38 |
+#if CONFIG_VP7_DECODER && CONFIG_VP8_DECODER |
|
39 |
+#define VPX(vp7, f) (vp7 ? vp7_ ## f : vp8_ ## f) |
|
40 |
+#elif CONFIG_VP7_DECODER |
|
41 |
+#define VPX(vp7, f) vp7_ ## f |
|
42 |
+#else // CONFIG_VP8_DECODER |
|
43 |
+#define VPX(vp7, f) vp8_ ## f |
|
44 |
+#endif |
|
45 |
+ |
|
38 | 46 |
static void free_buffers(VP8Context *s) |
39 | 47 |
{ |
40 | 48 |
int i; |
... | ... |
@@ -74,6 +83,7 @@ static void vp8_release_frame(VP8Context *s, VP8Frame *f) |
74 | 74 |
ff_thread_release_buffer(s->avctx, &f->tf); |
75 | 75 |
} |
76 | 76 |
|
77 |
+#if CONFIG_VP8_DECODER |
|
77 | 78 |
static int vp8_ref_frame(VP8Context *s, VP8Frame *dst, VP8Frame *src) |
78 | 79 |
{ |
79 | 80 |
int ret; |
... | ... |
@@ -90,6 +100,7 @@ static int vp8_ref_frame(VP8Context *s, VP8Frame *dst, VP8Frame *src) |
90 | 90 |
|
91 | 91 |
return 0; |
92 | 92 |
} |
93 |
+#endif |
|
93 | 94 |
|
94 | 95 |
|
95 | 96 |
static void vp8_decode_flush_impl(AVCodecContext *avctx, int free_mem) |
... | ... |
@@ -151,7 +162,7 @@ static int update_dimensions(VP8Context *s, int width, int height) |
151 | 151 |
s->mb_width = (s->avctx->coded_width +15) / 16; |
152 | 152 |
s->mb_height = (s->avctx->coded_height+15) / 16; |
153 | 153 |
|
154 |
- s->mb_layout = (avctx->active_thread_type == FF_THREAD_SLICE) && (FFMIN(s->num_coeff_partitions, avctx->thread_count) > 1); |
|
154 |
+ s->mb_layout = s->vp7 || (avctx->active_thread_type == FF_THREAD_SLICE) && (FFMIN(s->num_coeff_partitions, avctx->thread_count) > 1); |
|
155 | 155 |
if (!s->mb_layout) { // Frame threading and one thread |
156 | 156 |
s->macroblocks_base = av_mallocz((s->mb_width+s->mb_height*2+1)*sizeof(*s->macroblocks)); |
157 | 157 |
s->intra4x4_pred_mode_top = av_mallocz(s->mb_width*4); |
... | ... |
@@ -179,6 +190,8 @@ static int update_dimensions(VP8Context *s, int width, int height) |
179 | 179 |
return 0; |
180 | 180 |
} |
181 | 181 |
|
182 |
+ |
|
183 |
+#if CONFIG_VP8_DECODER |
|
182 | 184 |
static void parse_segment_info(VP8Context *s) |
183 | 185 |
{ |
184 | 186 |
VP56RangeCoder *c = &s->c; |
... | ... |
@@ -249,8 +262,31 @@ static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size) |
249 | 249 |
|
250 | 250 |
return 0; |
251 | 251 |
} |
252 |
+#endif |
|
253 |
+ |
|
254 |
+#if CONFIG_VP7_DECODER |
|
255 |
+static void vp7_get_quants(VP8Context *s) |
|
256 |
+{ |
|
257 |
+ VP56RangeCoder *c = &s->c; |
|
258 |
+ |
|
259 |
+ int yac_qi = vp8_rac_get_uint(c, 7); |
|
260 |
+ int ydc_qi = vp8_rac_get(c) ? vp8_rac_get_uint(c, 7) : yac_qi; |
|
261 |
+ int y2dc_qi = vp8_rac_get(c) ? vp8_rac_get_uint(c, 7) : yac_qi; |
|
262 |
+ int y2ac_qi = vp8_rac_get(c) ? vp8_rac_get_uint(c, 7) : yac_qi; |
|
263 |
+ int uvdc_qi = vp8_rac_get(c) ? vp8_rac_get_uint(c, 7) : yac_qi; |
|
264 |
+ int uvac_qi = vp8_rac_get(c) ? vp8_rac_get_uint(c, 7) : yac_qi; |
|
265 |
+ |
|
266 |
+ s->qmat[0].luma_qmul[0] = vp7_ydc_qlookup[ydc_qi]; |
|
267 |
+ s->qmat[0].luma_qmul[1] = vp7_yac_qlookup[yac_qi]; |
|
268 |
+ s->qmat[0].luma_dc_qmul[0] = vp7_y2dc_qlookup[y2dc_qi]; |
|
269 |
+ s->qmat[0].luma_dc_qmul[1] = vp7_y2ac_qlookup[y2ac_qi]; |
|
270 |
+ s->qmat[0].chroma_qmul[0] = FFMIN(vp7_ydc_qlookup[uvdc_qi], 132); |
|
271 |
+ s->qmat[0].chroma_qmul[1] = vp7_yac_qlookup[uvac_qi]; |
|
272 |
+} |
|
273 |
+#endif |
|
252 | 274 |
|
253 |
-static void get_quants(VP8Context *s) |
|
275 |
+#if CONFIG_VP8_DECODER |
|
276 |
+static void vp8_get_quants(VP8Context *s) |
|
254 | 277 |
{ |
255 | 278 |
VP56RangeCoder *c = &s->c; |
256 | 279 |
int i, base_qi; |
... | ... |
@@ -311,7 +347,53 @@ static VP56Frame ref_to_update(VP8Context *s, int update, VP56Frame ref) |
311 | 311 |
} |
312 | 312 |
return VP56_FRAME_NONE; |
313 | 313 |
} |
314 |
+#endif |
|
315 |
+ |
|
316 |
+static void vp78_reset_probability_tables(VP8Context *s) |
|
317 |
+{ |
|
318 |
+ int i, j; |
|
319 |
+ for (i = 0; i < 4; i++) |
|
320 |
+ for (j = 0; j < 16; j++) |
|
321 |
+ memcpy(s->prob->token[i][j], vp8_token_default_probs[i][vp8_coeff_band[j]], |
|
322 |
+ sizeof(s->prob->token[i][j])); |
|
323 |
+} |
|
324 |
+ |
|
325 |
+static void vp78_update_probability_tables(VP8Context *s) |
|
326 |
+{ |
|
327 |
+ VP56RangeCoder *c = &s->c; |
|
328 |
+ int i, j, k, l, m; |
|
329 |
+ |
|
330 |
+ for (i = 0; i < 4; i++) |
|
331 |
+ for (j = 0; j < 8; j++) |
|
332 |
+ for (k = 0; k < 3; k++) |
|
333 |
+ for (l = 0; l < NUM_DCT_TOKENS-1; l++) |
|
334 |
+ if (vp56_rac_get_prob_branchy(c, vp8_token_update_probs[i][j][k][l])) { |
|
335 |
+ int prob = vp8_rac_get_uint(c, 8); |
|
336 |
+ for (m = 0; vp8_coeff_band_indexes[j][m] >= 0; m++) |
|
337 |
+ s->prob->token[i][vp8_coeff_band_indexes[j][m]][k][l] = prob; |
|
338 |
+ } |
|
339 |
+} |
|
340 |
+ |
|
341 |
+static void vp78_update_pred16x16_pred8x8_mvc_probabilities(VP8Context *s) |
|
342 |
+{ |
|
343 |
+ VP56RangeCoder *c = &s->c; |
|
344 |
+ int i, j; |
|
345 |
+ |
|
346 |
+ if (vp8_rac_get(c)) |
|
347 |
+ for (i = 0; i < 4; i++) |
|
348 |
+ s->prob->pred16x16[i] = vp8_rac_get_uint(c, 8); |
|
349 |
+ if (vp8_rac_get(c)) |
|
350 |
+ for (i = 0; i < 3; i++) |
|
351 |
+ s->prob->pred8x8c[i] = vp8_rac_get_uint(c, 8); |
|
352 |
+ |
|
353 |
+ // 17.2 MV probability update |
|
354 |
+ for (i = 0; i < 2; i++) |
|
355 |
+ for (j = 0; j < (s->vp7 ? 17 : 19); j++) |
|
356 |
+ if (vp56_rac_get_prob_branchy(c, vp8_mv_update_prob[i][j])) |
|
357 |
+ s->prob->mvc[i][j] = vp8_rac_get_nn(c); |
|
358 |
+} |
|
314 | 359 |
|
360 |
+#if CONFIG_VP8_DECODER |
|
315 | 361 |
static void update_refs(VP8Context *s) |
316 | 362 |
{ |
317 | 363 |
VP56RangeCoder *c = &s->c; |
... | ... |
@@ -322,11 +404,182 @@ static void update_refs(VP8Context *s) |
322 | 322 |
s->update_golden = ref_to_update(s, update_golden, VP56_FRAME_GOLDEN); |
323 | 323 |
s->update_altref = ref_to_update(s, update_altref, VP56_FRAME_GOLDEN2); |
324 | 324 |
} |
325 |
+#endif |
|
326 |
+ |
|
327 |
+#if CONFIG_VP7_DECODER |
|
328 |
+static void fade(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int width, int height, int alpha, int beta) |
|
329 |
+{ |
|
330 |
+ int i, j; |
|
331 |
+ for (j = 0; j < height; j++) |
|
332 |
+ for (i = 0; i < width; i++) { |
|
333 |
+ uint8_t y = src[j*src_linesize + i]; |
|
334 |
+ dst[j*dst_linesize + i] = av_clip_uint8(y + ((y * beta) >> 8) + alpha); |
|
335 |
+ } |
|
336 |
+} |
|
337 |
+ |
|
338 |
+static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
|
339 |
+{ |
|
340 |
+ VP56RangeCoder *c = &s->c; |
|
341 |
+ int part1_size, hscale, vscale, i, j, ret; |
|
342 |
+ int width = s->avctx->width; |
|
343 |
+ int height = s->avctx->height; |
|
344 |
+ |
|
345 |
+ s->profile = (buf[0]>>1) & 7; |
|
346 |
+ if (s->profile > 1) { |
|
347 |
+ avpriv_request_sample(s->avctx, "Unknown profile %d", s->profile); |
|
348 |
+ return AVERROR_INVALIDDATA; |
|
349 |
+ } |
|
350 |
+ |
|
351 |
+ s->keyframe = !(buf[0] & 1); |
|
352 |
+ s->invisible = 0; |
|
353 |
+ part1_size = AV_RL24(buf) >> 4; |
|
354 |
+ |
|
355 |
+ buf += 4 - s->profile; |
|
356 |
+ buf_size -= 4 - s->profile; |
|
357 |
+ |
|
358 |
+ memcpy(s->put_pixels_tab, s->vp8dsp.put_vp8_epel_pixels_tab, sizeof(s->put_pixels_tab)); |
|
359 |
+ |
|
360 |
+ ff_vp56_init_range_decoder(c, buf, part1_size); |
|
361 |
+ buf += part1_size; |
|
362 |
+ buf_size -= part1_size; |
|
363 |
+ |
|
364 |
+ /* A. Dimension information (keyframes only) */ |
|
365 |
+ if (s->keyframe) { |
|
366 |
+ width = vp8_rac_get_uint(c, 12); |
|
367 |
+ height = vp8_rac_get_uint(c, 12); |
|
368 |
+ hscale = vp8_rac_get_uint(c, 2); |
|
369 |
+ vscale = vp8_rac_get_uint(c, 2); |
|
370 |
+ if (hscale || vscale) |
|
371 |
+ avpriv_request_sample(s->avctx, "Upscaling"); |
|
372 |
+ |
|
373 |
+ s->update_golden = s->update_altref = VP56_FRAME_CURRENT; |
|
374 |
+ vp78_reset_probability_tables(s); |
|
375 |
+ memcpy(s->prob->pred16x16, vp8_pred16x16_prob_inter, sizeof(s->prob->pred16x16)); |
|
376 |
+ memcpy(s->prob->pred8x8c , vp8_pred8x8c_prob_inter , sizeof(s->prob->pred8x8c)); |
|
377 |
+ for (i = 0; i < 2; i++) |
|
378 |
+ memcpy(s->prob->mvc[i], vp7_mv_default_prob[i], sizeof(vp7_mv_default_prob[i])); |
|
379 |
+ memset(&s->segmentation, 0, sizeof(s->segmentation)); |
|
380 |
+ memset(&s->lf_delta, 0, sizeof(s->lf_delta)); |
|
381 |
+ memcpy(s->prob[0].scan, zigzag_scan, sizeof(s->prob[0].scan)); |
|
382 |
+ } |
|
383 |
+ |
|
384 |
+ if (s->keyframe || s->profile > 0) |
|
385 |
+ memset(s->inter_dc_pred, 0 , sizeof(s->inter_dc_pred)); |
|
386 |
+ |
|
387 |
+ /* B. Decoding information for all four macroblock-level features */ |
|
388 |
+ for (i = 0; i < 4; i++) { |
|
389 |
+ s->feature_enabled[i] = vp8_rac_get(c); |
|
390 |
+ if (s->feature_enabled[i]) { |
|
391 |
+ s->feature_present_prob[i] = vp8_rac_get_uint(c, 8); |
|
392 |
+ |
|
393 |
+ for (j = 0; j < 3; j++) |
|
394 |
+ s->feature_index_prob[i][j] = vp8_rac_get(c) ? vp8_rac_get_uint(c, 8) : 255; |
|
395 |
+ |
|
396 |
+ if (vp7_feature_value_size[i]) |
|
397 |
+ for (j = 0; j < 4; j++) |
|
398 |
+ s->feature_value[i][j] = vp8_rac_get(c) ? vp8_rac_get_uint(c, vp7_feature_value_size[s->profile][i]) : 0; |
|
399 |
+ } |
|
400 |
+ } |
|
401 |
+ |
|
402 |
+ s->segmentation.enabled = 0; |
|
403 |
+ s->segmentation.update_map = 0; |
|
404 |
+ s->lf_delta.enabled = 0; |
|
405 |
+ |
|
406 |
+ s->num_coeff_partitions = 1; |
|
407 |
+ ff_vp56_init_range_decoder(&s->coeff_partition[0], buf, buf_size); |
|
408 |
+ |
|
409 |
+ if (!s->macroblocks_base || /* first frame */ |
|
410 |
+ width != s->avctx->width || height != s->avctx->height || (width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) { |
|
411 |
+ if ((ret = update_dimensions(s, width, height)) < 0) |
|
412 |
+ return ret; |
|
413 |
+ } |
|
414 |
+ |
|
415 |
+ /* C. Dequantization indices */ |
|
416 |
+ vp7_get_quants(s); |
|
417 |
+ |
|
418 |
+ /* D. Golden frame update flag (a Flag) for interframes only */ |
|
419 |
+ if (!s->keyframe) { |
|
420 |
+ s->update_golden = vp8_rac_get(c) ? VP56_FRAME_CURRENT : VP56_FRAME_NONE; |
|
421 |
+ s->sign_bias[VP56_FRAME_GOLDEN] = 0; |
|
422 |
+ } |
|
423 |
+ |
|
424 |
+ s->update_last = 1; |
|
425 |
+ s->update_probabilities = 1; |
|
426 |
+ s->fade_present = 1; |
|
427 |
+ |
|
428 |
+ if (s->profile > 0) { |
|
429 |
+ s->update_probabilities = vp8_rac_get(c); |
|
430 |
+ if (!s->update_probabilities) |
|
431 |
+ s->prob[1] = s->prob[0]; |
|
432 |
+ |
|
433 |
+ if (!s->keyframe) |
|
434 |
+ s->fade_present = vp8_rac_get(c); |
|
435 |
+ } |
|
436 |
+ |
|
437 |
+ /* E. Fading information for previous frame */ |
|
438 |
+ if (s->fade_present && vp8_rac_get(c)) { |
|
439 |
+ int alpha = (int8_t)vp8_rac_get_uint(c, 8); |
|
440 |
+ int beta = (int8_t)vp8_rac_get_uint(c, 8); |
|
441 |
+ if (!s->keyframe && (alpha || beta)) { |
|
442 |
+ /* preserve the golden frame */ |
|
443 |
+ if (s->framep[VP56_FRAME_GOLDEN] == s->framep[VP56_FRAME_PREVIOUS]) { |
|
444 |
+ AVFrame *gold = s->framep[VP56_FRAME_GOLDEN]->tf.f; |
|
445 |
+ AVFrame *prev; |
|
446 |
+ int i, j; |
|
447 |
+ |
|
448 |
+ s->framep[VP56_FRAME_PREVIOUS] = vp8_find_free_buffer(s); |
|
449 |
+ if ((ret = vp8_alloc_frame(s, s->framep[VP56_FRAME_PREVIOUS], 1)) < 0) |
|
450 |
+ return ret; |
|
451 |
+ prev = s->framep[VP56_FRAME_PREVIOUS]->tf.f; |
|
452 |
+ |
|
453 |
+ fade(prev->data[0], prev->linesize[0], gold->data[0], gold->linesize[0], s->mb_width * 16, s->mb_height * 16, alpha, beta); |
|
454 |
+ for (j = 1; j < 3; j++) |
|
455 |
+ for (i = 0; i < s->mb_height * 8; i++) |
|
456 |
+ memcpy(prev->data[j] + i * prev->linesize[j], gold->data[j] + i * gold->linesize[j], s->mb_width * 8); |
|
457 |
+ } else { |
|
458 |
+ AVFrame *prev = s->framep[VP56_FRAME_PREVIOUS]->tf.f; |
|
459 |
+ fade(prev->data[0], prev->linesize[0], prev->data[0], prev->linesize[0], s->mb_width * 16, s->mb_height * 16, alpha, beta); |
|
460 |
+ } |
|
461 |
+ |
|
462 |
+ } |
|
463 |
+ } |
|
464 |
+ |
|
465 |
+ /* F. Loop filter type */ |
|
466 |
+ if (!s->profile) |
|
467 |
+ s->filter.simple = vp8_rac_get(c); |
|
468 |
+ |
|
469 |
+ /* G. DCT coefficient ordering specification */ |
|
470 |
+ if (vp8_rac_get(c)) |
|
471 |
+ for (i = 1; i < 16; i++) |
|
472 |
+ s->prob[0].scan[i] = zigzag_scan[vp8_rac_get_uint(c, 4)]; |
|
473 |
+ |
|
474 |
+ /* H. Loop filter levels */ |
|
475 |
+ if (s->profile > 0) |
|
476 |
+ s->filter.simple = vp8_rac_get(c); |
|
477 |
+ s->filter.level = vp8_rac_get_uint(c, 6); |
|
478 |
+ s->filter.sharpness = vp8_rac_get_uint(c, 3); |
|
479 |
+ |
|
480 |
+ /* I. DCT coefficient probability update; 13.3 Token Probability Updates */ |
|
481 |
+ vp78_update_probability_tables(s); |
|
482 |
+ |
|
483 |
+ s->mbskip_enabled = 0; |
|
484 |
+ |
|
485 |
+ /* J. The remaining frame header data occurs ONLY FOR INTERFRAMES */ |
|
486 |
+ if (!s->keyframe) { |
|
487 |
+ s->prob->intra = vp8_rac_get_uint(c, 8); |
|
488 |
+ s->prob->last = vp8_rac_get_uint(c, 8); |
|
489 |
+ vp78_update_pred16x16_pred8x8_mvc_probabilities(s); |
|
490 |
+ } |
|
491 |
+ |
|
492 |
+ return 0; |
|
493 |
+} |
|
494 |
+#endif |
|
325 | 495 |
|
326 |
-static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
|
496 |
+#if CONFIG_VP8_DECODER |
|
497 |
+static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
|
327 | 498 |
{ |
328 | 499 |
VP56RangeCoder *c = &s->c; |
329 |
- int header_size, hscale, vscale, i, j, k, l, m, ret; |
|
500 |
+ int header_size, hscale, vscale, ret; |
|
330 | 501 |
int width = s->avctx->width; |
331 | 502 |
int height = s->avctx->height; |
332 | 503 |
|
... | ... |
@@ -366,10 +619,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
366 | 366 |
avpriv_request_sample(s->avctx, "Upscaling"); |
367 | 367 |
|
368 | 368 |
s->update_golden = s->update_altref = VP56_FRAME_CURRENT; |
369 |
- for (i = 0; i < 4; i++) |
|
370 |
- for (j = 0; j < 16; j++) |
|
371 |
- memcpy(s->prob->token[i][j], vp8_token_default_probs[i][vp8_coeff_band[j]], |
|
372 |
- sizeof(s->prob->token[i][j])); |
|
369 |
+ vp78_reset_probability_tables(s); |
|
373 | 370 |
memcpy(s->prob->pred16x16, vp8_pred16x16_prob_inter, sizeof(s->prob->pred16x16)); |
374 | 371 |
memcpy(s->prob->pred8x8c , vp8_pred8x8c_prob_inter , sizeof(s->prob->pred8x8c)); |
375 | 372 |
memcpy(s->prob->mvc , vp8_mv_default_prob , sizeof(s->prob->mvc)); |
... | ... |
@@ -411,7 +661,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
411 | 411 |
return ret; |
412 | 412 |
} |
413 | 413 |
|
414 |
- get_quants(s); |
|
414 |
+ vp8_get_quants(s); |
|
415 | 415 |
|
416 | 416 |
if (!s->keyframe) { |
417 | 417 |
update_refs(s); |
... | ... |
@@ -426,15 +676,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
426 | 426 |
|
427 | 427 |
s->update_last = s->keyframe || vp8_rac_get(c); |
428 | 428 |
|
429 |
- for (i = 0; i < 4; i++) |
|
430 |
- for (j = 0; j < 8; j++) |
|
431 |
- for (k = 0; k < 3; k++) |
|
432 |
- for (l = 0; l < NUM_DCT_TOKENS-1; l++) |
|
433 |
- if (vp56_rac_get_prob_branchy(c, vp8_token_update_probs[i][j][k][l])) { |
|
434 |
- int prob = vp8_rac_get_uint(c, 8); |
|
435 |
- for (m = 0; vp8_coeff_band_indexes[j][m] >= 0; m++) |
|
436 |
- s->prob->token[i][vp8_coeff_band_indexes[j][m]][k][l] = prob; |
|
437 |
- } |
|
429 |
+ vp78_update_probability_tables(s); |
|
438 | 430 |
|
439 | 431 |
if ((s->mbskip_enabled = vp8_rac_get(c))) |
440 | 432 |
s->prob->mbskip = vp8_rac_get_uint(c, 8); |
... | ... |
@@ -443,23 +685,12 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
443 | 443 |
s->prob->intra = vp8_rac_get_uint(c, 8); |
444 | 444 |
s->prob->last = vp8_rac_get_uint(c, 8); |
445 | 445 |
s->prob->golden = vp8_rac_get_uint(c, 8); |
446 |
- |
|
447 |
- if (vp8_rac_get(c)) |
|
448 |
- for (i = 0; i < 4; i++) |
|
449 |
- s->prob->pred16x16[i] = vp8_rac_get_uint(c, 8); |
|
450 |
- if (vp8_rac_get(c)) |
|
451 |
- for (i = 0; i < 3; i++) |
|
452 |
- s->prob->pred8x8c[i] = vp8_rac_get_uint(c, 8); |
|
453 |
- |
|
454 |
- // 17.2 MV probability update |
|
455 |
- for (i = 0; i < 2; i++) |
|
456 |
- for (j = 0; j < 19; j++) |
|
457 |
- if (vp56_rac_get_prob_branchy(c, vp8_mv_update_prob[i][j])) |
|
458 |
- s->prob->mvc[i][j] = vp8_rac_get_nn(c); |
|
446 |
+ vp78_update_pred16x16_pred8x8_mvc_probabilities(s); |
|
459 | 447 |
} |
460 | 448 |
|
461 | 449 |
return 0; |
462 | 450 |
} |
451 |
+#endif |
|
463 | 452 |
|
464 | 453 |
static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src) |
465 | 454 |
{ |
... | ... |
@@ -470,7 +701,7 @@ static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv * |
470 | 470 |
/** |
471 | 471 |
* Motion vector coding, 17.1. |
472 | 472 |
*/ |
473 |
-static int read_mv_component(VP56RangeCoder *c, const uint8_t *p) |
|
473 |
+static av_always_inline int read_mv_component(VP56RangeCoder *c, const uint8_t *p, int vp7) |
|
474 | 474 |
{ |
475 | 475 |
int bit, x = 0; |
476 | 476 |
|
... | ... |
@@ -479,9 +710,9 @@ static int read_mv_component(VP56RangeCoder *c, const uint8_t *p) |
479 | 479 |
|
480 | 480 |
for (i = 0; i < 3; i++) |
481 | 481 |
x += vp56_rac_get_prob(c, p[9 + i]) << i; |
482 |
- for (i = 9; i > 3; i--) |
|
482 |
+ for (i = (vp7 ? 7 : 9); i > 3; i--) |
|
483 | 483 |
x += vp56_rac_get_prob(c, p[9 + i]) << i; |
484 |
- if (!(x & 0xFFF0) || vp56_rac_get_prob(c, p[12])) |
|
484 |
+ if (!(x & (vp7 ? 0xF0 : 0xFFF0)) || vp56_rac_get_prob(c, p[12])) |
|
485 | 485 |
x += 8; |
486 | 486 |
} else { |
487 | 487 |
// small_mvtree |
... | ... |
@@ -498,6 +729,16 @@ static int read_mv_component(VP56RangeCoder *c, const uint8_t *p) |
498 | 498 |
return (x && vp56_rac_get_prob(c, p[1])) ? -x : x; |
499 | 499 |
} |
500 | 500 |
|
501 |
+static int vp7_read_mv_component(VP56RangeCoder *c, const uint8_t *p) |
|
502 |
+{ |
|
503 |
+ return read_mv_component(c, p, 1); |
|
504 |
+} |
|
505 |
+ |
|
506 |
+static int vp8_read_mv_component(VP56RangeCoder *c, const uint8_t *p) |
|
507 |
+{ |
|
508 |
+ return read_mv_component(c, p, 0); |
|
509 |
+} |
|
510 |
+ |
|
501 | 511 |
static av_always_inline |
502 | 512 |
const uint8_t *get_submv_prob(uint32_t left, uint32_t top) |
503 | 513 |
{ |
... | ... |
@@ -513,7 +754,7 @@ const uint8_t *get_submv_prob(uint32_t left, uint32_t top) |
513 | 513 |
* @returns the number of motion vectors parsed (2, 4 or 16) |
514 | 514 |
*/ |
515 | 515 |
static av_always_inline |
516 |
-int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, int layout) |
|
516 |
+int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, int layout, int vp7) |
|
517 | 517 |
{ |
518 | 518 |
int part_idx; |
519 | 519 |
int n, num; |
... | ... |
@@ -562,13 +803,13 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, int lay |
562 | 562 |
else |
563 | 563 |
above = AV_RN32A(&cur_mv[mbsplits_cur[k - 4]]); |
564 | 564 |
|
565 |
- submv_prob = get_submv_prob(left, above); |
|
565 |
+ submv_prob = vp7 ? vp7_submv_prob : get_submv_prob(left, above); |
|
566 | 566 |
|
567 | 567 |
if (vp56_rac_get_prob_branchy(c, submv_prob[0])) { |
568 | 568 |
if (vp56_rac_get_prob_branchy(c, submv_prob[1])) { |
569 | 569 |
if (vp56_rac_get_prob_branchy(c, submv_prob[2])) { |
570 |
- mb->bmv[n].y = mb->mv.y + read_mv_component(c, s->prob->mvc[0]); |
|
571 |
- mb->bmv[n].x = mb->mv.x + read_mv_component(c, s->prob->mvc[1]); |
|
570 |
+ mb->bmv[n].y = mb->mv.y + VPX(vp7, read_mv_component)(c, s->prob->mvc[0]); |
|
571 |
+ mb->bmv[n].x = mb->mv.x + VPX(vp7, read_mv_component)(c, s->prob->mvc[1]); |
|
572 | 572 |
} else { |
573 | 573 |
AV_ZERO32(&mb->bmv[n]); |
574 | 574 |
} |
... | ... |
@@ -583,8 +824,120 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, int lay |
583 | 583 |
return num; |
584 | 584 |
} |
585 | 585 |
|
586 |
+/** |
|
587 |
+ * the vp7 reference decoder uses a padding macroblock column (added to right |
|
588 |
+ * edge of the frame) to guard against illegal macroblock offsets. The algorithm |
|
589 |
+ * has bugs that permit offsets to straddle the padding column. This function |
|
590 |
+ * replicates those bugs. |
|
591 |
+ * @param[out] edge_x macroblock x address |
|
592 |
+ * @param[out] edge_y macroblock y address |
|
593 |
+ * @return macroblock offset legal (boolean) |
|
594 |
+ */ |
|
595 |
+static int vp7_calculate_mb_offset(int mb_x, int mb_y, int mb_width, int xoffset, int yoffset, int boundary, int *edge_x, int *edge_y) |
|
596 |
+{ |
|
597 |
+ int vwidth = mb_width + 1; |
|
598 |
+ int new = (mb_y + yoffset) * vwidth + mb_x + xoffset; |
|
599 |
+ if (new < boundary || new % vwidth == vwidth - 1) |
|
600 |
+ return 0; |
|
601 |
+ *edge_y = new / vwidth; |
|
602 |
+ *edge_x = new % vwidth; |
|
603 |
+ return 1; |
|
604 |
+} |
|
605 |
+ |
|
606 |
+static const VP56mv * get_bmv_ptr(const VP8Macroblock *mb, int subblock) |
|
607 |
+{ |
|
608 |
+ return &mb->bmv[mb->mode == VP8_MVMODE_SPLIT ? vp8_mbsplits[mb->partitioning][subblock] : 0]; |
|
609 |
+} |
|
610 |
+ |
|
586 | 611 |
static av_always_inline |
587 |
-void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int layout) |
|
612 |
+void vp7_decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int layout) |
|
613 |
+{ |
|
614 |
+ VP8Macroblock *mb_edge[12]; |
|
615 |
+ enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR }; |
|
616 |
+ enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT }; |
|
617 |
+ int idx = CNT_ZERO; |
|
618 |
+ VP56mv near_mv[3]; |
|
619 |
+ uint8_t cnt[3] = { 0 }; |
|
620 |
+ VP56RangeCoder *c = &s->c; |
|
621 |
+ int i; |
|
622 |
+ |
|
623 |
+ AV_ZERO32(&near_mv[0]); |
|
624 |
+ AV_ZERO32(&near_mv[1]); |
|
625 |
+ AV_ZERO32(&near_mv[2]); |
|
626 |
+ |
|
627 |
+ for (i = 0; i < VP7_MV_PRED_COUNT; i++) { |
|
628 |
+ const VP7MVPred * pred = &vp7_mv_pred[i]; |
|
629 |
+ int edge_x, edge_y; |
|
630 |
+ |
|
631 |
+ if (vp7_calculate_mb_offset(mb_x, mb_y, s->mb_width, pred->xoffset, pred->yoffset, !s->profile, &edge_x, &edge_y)) { |
|
632 |
+ VP8Macroblock *edge = mb_edge[i] = (s->mb_layout == 1) ? |
|
633 |
+ s->macroblocks_base + (s->mb_width+1)*(edge_y + 1) + 1 + edge_x : |
|
634 |
+ s->macroblocks + (s->mb_height - edge_y - 1)*2 + edge_x; |
|
635 |
+ uint32_t mv = AV_RN32A(get_bmv_ptr(edge, vp7_mv_pred[i].subblock)); |
|
636 |
+ if (mv) { |
|
637 |
+ if (AV_RN32A(&near_mv[CNT_NEAREST])) { |
|
638 |
+ if (mv == AV_RN32A(&near_mv[CNT_NEAREST])) { |
|
639 |
+ idx = CNT_NEAREST; |
|
640 |
+ } else if (AV_RN32A(&near_mv[CNT_NEAR])) { |
|
641 |
+ if (mv != AV_RN32A(&near_mv[CNT_NEAR])) |
|
642 |
+ continue; |
|
643 |
+ idx = CNT_NEAR; |
|
644 |
+ } else { |
|
645 |
+ AV_WN32A(&near_mv[CNT_NEAR], mv); |
|
646 |
+ idx = CNT_NEAR; |
|
647 |
+ } |
|
648 |
+ } else { |
|
649 |
+ AV_WN32A(&near_mv[CNT_NEAREST], mv); |
|
650 |
+ idx = CNT_NEAREST; |
|
651 |
+ } |
|
652 |
+ } else { |
|
653 |
+ idx = CNT_ZERO; |
|
654 |
+ } |
|
655 |
+ } else { |
|
656 |
+ idx = CNT_ZERO; |
|
657 |
+ } |
|
658 |
+ cnt[idx] += vp7_mv_pred[i].score; |
|
659 |
+ } |
|
660 |
+ |
|
661 |
+ mb->partitioning = VP8_SPLITMVMODE_NONE; |
|
662 |
+ |
|
663 |
+ if (vp56_rac_get_prob_branchy(c, vp7_mode_contexts[cnt[CNT_ZERO]][0])) { |
|
664 |
+ mb->mode = VP8_MVMODE_MV; |
|
665 |
+ |
|
666 |
+ if (vp56_rac_get_prob_branchy(c, vp7_mode_contexts[cnt[CNT_NEAREST]][1])) { |
|
667 |
+ |
|
668 |
+ if (vp56_rac_get_prob_branchy(c, vp7_mode_contexts[cnt[CNT_NEAR]][2])) { |
|
669 |
+ |
|
670 |
+ if (cnt[CNT_NEAREST] > cnt[CNT_NEAR]) |
|
671 |
+ AV_WN32A(&mb->mv, cnt[CNT_ZERO] > cnt[CNT_NEAREST] ? 0 : AV_RN32A(&near_mv[CNT_NEAREST])); |
|
672 |
+ else |
|
673 |
+ AV_WN32A(&mb->mv, cnt[CNT_ZERO] > cnt[CNT_NEAR] ? 0 : AV_RN32A(&near_mv[CNT_NEAR])); |
|
674 |
+ |
|
675 |
+ if (vp56_rac_get_prob_branchy(c, vp7_mode_contexts[cnt[CNT_NEAR]][3])) { |
|
676 |
+ mb->mode = VP8_MVMODE_SPLIT; |
|
677 |
+ mb->mv = mb->bmv[decode_splitmvs(s, c, mb, layout, 1) - 1]; |
|
678 |
+ } else { |
|
679 |
+ mb->mv.y += vp7_read_mv_component(c, s->prob->mvc[0]); |
|
680 |
+ mb->mv.x += vp7_read_mv_component(c, s->prob->mvc[1]); |
|
681 |
+ mb->bmv[0] = mb->mv; |
|
682 |
+ } |
|
683 |
+ } else { |
|
684 |
+ mb->mv = near_mv[CNT_NEAR]; |
|
685 |
+ mb->bmv[0] = mb->mv; |
|
686 |
+ } |
|
687 |
+ } else { |
|
688 |
+ mb->mv = near_mv[CNT_NEAREST]; |
|
689 |
+ mb->bmv[0] = mb->mv; |
|
690 |
+ } |
|
691 |
+ } else { |
|
692 |
+ mb->mode = VP8_MVMODE_ZERO; |
|
693 |
+ AV_ZERO32(&mb->mv); |
|
694 |
+ mb->bmv[0] = mb->mv; |
|
695 |
+ } |
|
696 |
+} |
|
697 |
+ |
|
698 |
+static av_always_inline |
|
699 |
+void vp8_decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int layout) |
|
588 | 700 |
{ |
589 | 701 |
VP8Macroblock *mb_edge[3] = { 0 /* top */, |
590 | 702 |
mb - 1 /* left */, |
... | ... |
@@ -661,10 +1014,10 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int layout |
661 | 661 |
|
662 | 662 |
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_SPLITMV]][3])) { |
663 | 663 |
mb->mode = VP8_MVMODE_SPLIT; |
664 |
- mb->mv = mb->bmv[decode_splitmvs(s, c, mb, layout) - 1]; |
|
664 |
+ mb->mv = mb->bmv[decode_splitmvs(s, c, mb, layout, 0) - 1]; |
|
665 | 665 |
} else { |
666 |
- mb->mv.y += read_mv_component(c, s->prob->mvc[0]); |
|
667 |
- mb->mv.x += read_mv_component(c, s->prob->mvc[1]); |
|
666 |
+ mb->mv.y += vp8_read_mv_component(c, s->prob->mvc[0]); |
|
667 |
+ mb->mv.x += vp8_read_mv_component(c, s->prob->mvc[1]); |
|
668 | 668 |
mb->bmv[0] = mb->mv; |
669 | 669 |
} |
670 | 670 |
} else { |
... | ... |
@@ -716,17 +1069,32 @@ void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, |
716 | 716 |
} |
717 | 717 |
} |
718 | 718 |
|
719 |
+static const char * vp7_feature_name[] = { "q-index", "lf-delta", "partial-golden-update", "blit-pitch" }; |
|
720 |
+ |
|
719 | 721 |
static av_always_inline |
720 | 722 |
void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
721 |
- uint8_t *segment, uint8_t *ref, int layout) |
|
723 |
+ uint8_t *segment, uint8_t *ref, int layout, int vp7) |
|
722 | 724 |
{ |
723 | 725 |
VP56RangeCoder *c = &s->c; |
724 | 726 |
|
725 |
- if (s->segmentation.update_map) { |
|
726 |
- int bit = vp56_rac_get_prob(c, s->prob->segmentid[0]); |
|
727 |
- *segment = vp56_rac_get_prob(c, s->prob->segmentid[1+bit]) + 2*bit; |
|
728 |
- } else if (s->segmentation.enabled) |
|
729 |
- *segment = ref ? *ref : *segment; |
|
727 |
+ if (vp7) { |
|
728 |
+ int i; |
|
729 |
+ *segment = 0; |
|
730 |
+ for (i = 0; i < 4; i++) { |
|
731 |
+ if (s->feature_enabled[i]) { |
|
732 |
+ if (vp56_rac_get_prob(c, s->feature_present_prob[i])) { |
|
733 |
+ int index = vp8_rac_get_tree(c, vp7_feature_index_tree, s->feature_index_prob[i]); |
|
734 |
+ av_log(s->avctx, AV_LOG_WARNING, "Feature %s present in macroblock (value 0x%x)\n", vp7_feature_name[i], s->feature_value[i][index]); |
|
735 |
+ } |
|
736 |
+ } |
|
737 |
+ } |
|
738 |
+ } else { |
|
739 |
+ if (s->segmentation.update_map) { |
|
740 |
+ int bit = vp56_rac_get_prob(c, s->prob->segmentid[0]); |
|
741 |
+ *segment = vp56_rac_get_prob(c, s->prob->segmentid[1+bit]) + 2*bit; |
|
742 |
+ } else if (s->segmentation.enabled) |
|
743 |
+ *segment = ref ? *ref : *segment; |
|
744 |
+ } |
|
730 | 745 |
mb->segment = *segment; |
731 | 746 |
|
732 | 747 |
mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0; |
... | ... |
@@ -737,7 +1105,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
737 | 737 |
if (mb->mode == MODE_I4x4) { |
738 | 738 |
decode_intra4x4_modes(s, c, mb, mb_x, 1, layout); |
739 | 739 |
} else { |
740 |
- const uint32_t modes = vp8_pred4x4_mode[mb->mode] * 0x01010101u; |
|
740 |
+ const uint32_t modes = VPX(vp7, pred4x4_mode)[mb->mode] * 0x01010101u; |
|
741 | 741 |
if (s->mb_layout) |
742 | 742 |
AV_WN32A(mb->intra4x4_pred_mode_top, modes); |
743 | 743 |
else |
... | ... |
@@ -750,14 +1118,17 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
750 | 750 |
} else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) { |
751 | 751 |
// inter MB, 16.2 |
752 | 752 |
if (vp56_rac_get_prob_branchy(c, s->prob->last)) |
753 |
- mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ? |
|
753 |
+ mb->ref_frame = (!vp7 && vp56_rac_get_prob(c, s->prob->golden)) ? |
|
754 | 754 |
VP56_FRAME_GOLDEN2 /* altref */ : VP56_FRAME_GOLDEN; |
755 | 755 |
else |
756 | 756 |
mb->ref_frame = VP56_FRAME_PREVIOUS; |
757 | 757 |
s->ref_count[mb->ref_frame-1]++; |
758 | 758 |
|
759 | 759 |
// motion vectors, 16.3 |
760 |
- decode_mvs(s, mb, mb_x, mb_y, layout); |
|
760 |
+ if (vp7) |
|
761 |
+ vp7_decode_mvs(s, mb, mb_x, mb_y, layout); |
|
762 |
+ else |
|
763 |
+ vp8_decode_mvs(s, mb, mb_x, mb_y, layout); |
|
761 | 764 |
} else { |
762 | 765 |
// intra MB, 16.1 |
763 | 766 |
mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16); |
... | ... |
@@ -772,7 +1143,28 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
772 | 772 |
} |
773 | 773 |
} |
774 | 774 |
|
775 |
-#ifndef decode_block_coeffs_internal |
|
775 |
+static av_always_inline int inter_predict_dc(int16_t block[16], int16_t pred[2]) |
|
776 |
+{ |
|
777 |
+ int16_t dc = block[0]; |
|
778 |
+ int ret = 0; |
|
779 |
+ |
|
780 |
+ if (pred[1] > 3) { |
|
781 |
+ dc += pred[0]; |
|
782 |
+ ret = 1; |
|
783 |
+ } |
|
784 |
+ |
|
785 |
+ if (!pred[0] || !dc || FFSIGN(pred[0]) != FFSIGN(dc)) { |
|
786 |
+ block[0] = pred[0] = dc; |
|
787 |
+ pred[1] = 0; |
|
788 |
+ } else { |
|
789 |
+ if (pred[0] == dc) |
|
790 |
+ pred[1]++; |
|
791 |
+ block[0] = pred[0] = dc; |
|
792 |
+ } |
|
793 |
+ |
|
794 |
+ return ret; |
|
795 |
+} |
|
796 |
+ |
|
776 | 797 |
/** |
777 | 798 |
* @param r arithmetic bitstream reader context |
778 | 799 |
* @param block destination for block coefficients |
... | ... |
@@ -782,14 +1174,17 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
782 | 782 |
* @return 0 if no coeffs were decoded |
783 | 783 |
* otherwise, the index of the last coeff decoded plus one |
784 | 784 |
*/ |
785 |
-static int decode_block_coeffs_internal(VP56RangeCoder *r, int16_t block[16], |
|
785 |
+static av_always_inline |
|
786 |
+int decode_block_coeffs_internal(VP56RangeCoder *r, int16_t block[16], |
|
786 | 787 |
uint8_t probs[16][3][NUM_DCT_TOKENS-1], |
787 |
- int i, uint8_t *token_prob, int16_t qmul[2]) |
|
788 |
+ int i, uint8_t *token_prob, int16_t qmul[2], |
|
789 |
+ const uint8_t scan[16], int vp7) |
|
788 | 790 |
{ |
789 | 791 |
VP56RangeCoder c = *r; |
790 | 792 |
goto skip_eob; |
791 | 793 |
do { |
792 | 794 |
int coeff; |
795 |
+restart: |
|
793 | 796 |
if (!vp56_rac_get_prob_branchy(&c, token_prob[0])) // DCT_EOB |
794 | 797 |
break; |
795 | 798 |
|
... | ... |
@@ -798,6 +1193,8 @@ skip_eob: |
798 | 798 |
if (++i == 16) |
799 | 799 |
break; // invalid input; blocks should end with EOB |
800 | 800 |
token_prob = probs[i][0]; |
801 |
+ if (vp7) |
|
802 |
+ goto restart; |
|
801 | 803 |
goto skip_eob; |
802 | 804 |
} |
803 | 805 |
|
... | ... |
@@ -830,12 +1227,28 @@ skip_eob: |
830 | 830 |
} |
831 | 831 |
token_prob = probs[i+1][2]; |
832 | 832 |
} |
833 |
- block[zigzag_scan[i]] = (vp8_rac_get(&c) ? -coeff : coeff) * qmul[!!i]; |
|
833 |
+ block[scan[i]] = (vp8_rac_get(&c) ? -coeff : coeff) * qmul[!!i]; |
|
834 | 834 |
} while (++i < 16); |
835 | 835 |
|
836 | 836 |
*r = c; |
837 | 837 |
return i; |
838 | 838 |
} |
839 |
+ |
|
840 |
+static int vp7_decode_block_coeffs_internal(VP56RangeCoder *r, int16_t block[16], |
|
841 |
+ uint8_t probs[16][3][NUM_DCT_TOKENS-1], |
|
842 |
+ int i, uint8_t *token_prob, int16_t qmul[2], |
|
843 |
+ const uint8_t scan[16]) |
|
844 |
+{ |
|
845 |
+ return decode_block_coeffs_internal(r, block, probs, i, token_prob, qmul, scan, 1); |
|
846 |
+} |
|
847 |
+ |
|
848 |
+#ifndef vp8_decode_block_coeffs_internal |
|
849 |
+static int vp8_decode_block_coeffs_internal(VP56RangeCoder *r, int16_t block[16], |
|
850 |
+ uint8_t probs[16][3][NUM_DCT_TOKENS-1], |
|
851 |
+ int i, uint8_t *token_prob, int16_t qmul[2]) |
|
852 |
+{ |
|
853 |
+ return decode_block_coeffs_internal(r, block, probs, i, token_prob, qmul, zigzag_scan, 0); |
|
854 |
+} |
|
839 | 855 |
#endif |
840 | 856 |
|
841 | 857 |
/** |
... | ... |
@@ -846,36 +1259,43 @@ skip_eob: |
846 | 846 |
* @param zero_nhood the initial prediction context for number of surrounding |
847 | 847 |
* all-zero blocks (only left/top, so 0-2) |
848 | 848 |
* @param qmul array holding the dc/ac dequant factor at position 0/1 |
849 |
+ * @param scan scan pattern (VP7 only) |
|
849 | 850 |
* @return 0 if no coeffs were decoded |
850 | 851 |
* otherwise, the index of the last coeff decoded plus one |
851 | 852 |
*/ |
852 | 853 |
static av_always_inline |
853 | 854 |
int decode_block_coeffs(VP56RangeCoder *c, int16_t block[16], |
854 | 855 |
uint8_t probs[16][3][NUM_DCT_TOKENS-1], |
855 |
- int i, int zero_nhood, int16_t qmul[2]) |
|
856 |
+ int i, int zero_nhood, int16_t qmul[2], |
|
857 |
+ const uint8_t scan[16], int vp7) |
|
856 | 858 |
{ |
857 | 859 |
uint8_t *token_prob = probs[i][zero_nhood]; |
858 | 860 |
if (!vp56_rac_get_prob_branchy(c, token_prob[0])) // DCT_EOB |
859 | 861 |
return 0; |
860 |
- return decode_block_coeffs_internal(c, block, probs, i, token_prob, qmul); |
|
862 |
+ return vp7 ? vp7_decode_block_coeffs_internal(c, block, probs, i, token_prob, qmul, scan) |
|
863 |
+ : vp8_decode_block_coeffs_internal(c, block, probs, i, token_prob, qmul); |
|
861 | 864 |
} |
862 | 865 |
|
863 | 866 |
static av_always_inline |
864 | 867 |
void decode_mb_coeffs(VP8Context *s, VP8ThreadData *td, VP56RangeCoder *c, VP8Macroblock *mb, |
865 |
- uint8_t t_nnz[9], uint8_t l_nnz[9]) |
|
868 |
+ uint8_t t_nnz[9], uint8_t l_nnz[9], int vp7) |
|
866 | 869 |
{ |
867 | 870 |
int i, x, y, luma_start = 0, luma_ctx = 3; |
868 | 871 |
int nnz_pred, nnz, nnz_total = 0; |
869 | 872 |
int segment = mb->segment; |
870 | 873 |
int block_dc = 0; |
871 | 874 |
|
872 |
- if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) { |
|
875 |
+ if (mb->mode != MODE_I4x4 && (vp7 || mb->mode != VP8_MVMODE_SPLIT)) { |
|
873 | 876 |
nnz_pred = t_nnz[8] + l_nnz[8]; |
874 | 877 |
|
875 | 878 |
// decode DC values and do hadamard |
876 | 879 |
nnz = decode_block_coeffs(c, td->block_dc, s->prob->token[1], 0, nnz_pred, |
877 |
- s->qmat[segment].luma_dc_qmul); |
|
880 |
+ s->qmat[segment].luma_dc_qmul, zigzag_scan, vp7); |
|
878 | 881 |
l_nnz[8] = t_nnz[8] = !!nnz; |
882 |
+ |
|
883 |
+ if (vp7 && mb->mode > MODE_I4x4) |
|
884 |
+ nnz |= inter_predict_dc(td->block_dc, s->inter_dc_pred[mb->ref_frame - 1]); |
|
885 |
+ |
|
879 | 886 |
if (nnz) { |
880 | 887 |
nnz_total += nnz; |
881 | 888 |
block_dc = 1; |
... | ... |
@@ -893,7 +1313,7 @@ void decode_mb_coeffs(VP8Context *s, VP8ThreadData *td, VP56RangeCoder *c, VP8Ma |
893 | 893 |
for (x = 0; x < 4; x++) { |
894 | 894 |
nnz_pred = l_nnz[y] + t_nnz[x]; |
895 | 895 |
nnz = decode_block_coeffs(c, td->block[y][x], s->prob->token[luma_ctx], luma_start, |
896 |
- nnz_pred, s->qmat[segment].luma_qmul); |
|
896 |
+ nnz_pred, s->qmat[segment].luma_qmul, s->prob[0].scan, vp7); |
|
897 | 897 |
// nnz+block_dc may be one more than the actual last index, but we don't care |
898 | 898 |
td->non_zero_count_cache[y][x] = nnz + block_dc; |
899 | 899 |
t_nnz[x] = l_nnz[y] = !!nnz; |
... | ... |
@@ -908,7 +1328,7 @@ void decode_mb_coeffs(VP8Context *s, VP8ThreadData *td, VP56RangeCoder *c, VP8Ma |
908 | 908 |
for (x = 0; x < 2; x++) { |
909 | 909 |
nnz_pred = l_nnz[i+2*y] + t_nnz[i+2*x]; |
910 | 910 |
nnz = decode_block_coeffs(c, td->block[i][(y<<1)+x], s->prob->token[2], 0, |
911 |
- nnz_pred, s->qmat[segment].chroma_qmul); |
|
911 |
+ nnz_pred, s->qmat[segment].chroma_qmul, s->prob[0].scan, vp7); |
|
912 | 912 |
td->non_zero_count_cache[i][(y<<1)+x] = nnz; |
913 | 913 |
t_nnz[i+2*x] = l_nnz[i+2*y] = !!nnz; |
914 | 914 |
nnz_total += nnz; |
... | ... |
@@ -974,43 +1394,43 @@ int check_dc_pred8x8_mode(int mode, int mb_x, int mb_y) |
974 | 974 |
} |
975 | 975 |
|
976 | 976 |
static av_always_inline |
977 |
-int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y) |
|
977 |
+int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y, int vp7) |
|
978 | 978 |
{ |
979 | 979 |
if (!mb_x) { |
980 |
- return mb_y ? VERT_PRED8x8 : DC_129_PRED8x8; |
|
980 |
+ return mb_y ? VERT_PRED8x8 : (vp7 ? DC_128_PRED8x8 : DC_129_PRED8x8); |
|
981 | 981 |
} else { |
982 | 982 |
return mb_y ? mode : HOR_PRED8x8; |
983 | 983 |
} |
984 | 984 |
} |
985 | 985 |
|
986 | 986 |
static av_always_inline |
987 |
-int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y) |
|
987 |
+int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y, int vp7) |
|
988 | 988 |
{ |
989 | 989 |
switch (mode) { |
990 | 990 |
case DC_PRED8x8: |
991 | 991 |
return check_dc_pred8x8_mode(mode, mb_x, mb_y); |
992 | 992 |
case VERT_PRED8x8: |
993 |
- return !mb_y ? DC_127_PRED8x8 : mode; |
|
993 |
+ return !mb_y ? (vp7 ? DC_128_PRED8x8 : DC_127_PRED8x8) : mode; |
|
994 | 994 |
case HOR_PRED8x8: |
995 |
- return !mb_x ? DC_129_PRED8x8 : mode; |
|
995 |
+ return !mb_x ? (vp7 ? DC_128_PRED8x8 : DC_129_PRED8x8) : mode; |
|
996 | 996 |
case PLANE_PRED8x8 /*TM*/: |
997 |
- return check_tm_pred8x8_mode(mode, mb_x, mb_y); |
|
997 |
+ return check_tm_pred8x8_mode(mode, mb_x, mb_y, vp7); |
|
998 | 998 |
} |
999 | 999 |
return mode; |
1000 | 1000 |
} |
1001 | 1001 |
|
1002 | 1002 |
static av_always_inline |
1003 |
-int check_tm_pred4x4_mode(int mode, int mb_x, int mb_y) |
|
1003 |
+int check_tm_pred4x4_mode(int mode, int mb_x, int mb_y, int vp7) |
|
1004 | 1004 |
{ |
1005 | 1005 |
if (!mb_x) { |
1006 |
- return mb_y ? VERT_VP8_PRED : DC_129_PRED; |
|
1006 |
+ return mb_y ? VERT_VP8_PRED : (vp7 ? DC_128_PRED : DC_129_PRED); |
|
1007 | 1007 |
} else { |
1008 | 1008 |
return mb_y ? mode : HOR_VP8_PRED; |
1009 | 1009 |
} |
1010 | 1010 |
} |
1011 | 1011 |
|
1012 | 1012 |
static av_always_inline |
1013 |
-int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf) |
|
1013 |
+int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf, int vp7) |
|
1014 | 1014 |
{ |
1015 | 1015 |
switch (mode) { |
1016 | 1016 |
case VERT_PRED: |
... | ... |
@@ -1021,7 +1441,7 @@ int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf |
1021 | 1021 |
/* fall-through */ |
1022 | 1022 |
case DIAG_DOWN_LEFT_PRED: |
1023 | 1023 |
case VERT_LEFT_PRED: |
1024 |
- return !mb_y ? DC_127_PRED : mode; |
|
1024 |
+ return !mb_y ? (vp7 ? DC_128_PRED : DC_127_PRED) : mode; |
|
1025 | 1025 |
case HOR_PRED: |
1026 | 1026 |
if (!mb_y) { |
1027 | 1027 |
*copy_buf = 1; |
... | ... |
@@ -1029,9 +1449,9 @@ int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf |
1029 | 1029 |
} |
1030 | 1030 |
/* fall-through */ |
1031 | 1031 |
case HOR_UP_PRED: |
1032 |
- return !mb_x ? DC_129_PRED : mode; |
|
1032 |
+ return !mb_x ? (vp7 ? DC_128_PRED : DC_129_PRED) : mode; |
|
1033 | 1033 |
case TM_VP8_PRED: |
1034 |
- return check_tm_pred4x4_mode(mode, mb_x, mb_y); |
|
1034 |
+ return check_tm_pred4x4_mode(mode, mb_x, mb_y, vp7); |
|
1035 | 1035 |
case DC_PRED: // 4x4 DC doesn't use the same "H.264-style" exceptions as 16x16/8x8 DC |
1036 | 1036 |
case DIAG_DOWN_RIGHT_PRED: |
1037 | 1037 |
case VERT_RIGHT_PRED: |
... | ... |
@@ -1045,7 +1465,7 @@ int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf |
1045 | 1045 |
|
1046 | 1046 |
static av_always_inline |
1047 | 1047 |
void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], |
1048 |
- VP8Macroblock *mb, int mb_x, int mb_y) |
|
1048 |
+ VP8Macroblock *mb, int mb_x, int mb_y, int vp7) |
|
1049 | 1049 |
{ |
1050 | 1050 |
int x, y, mode, nnz; |
1051 | 1051 |
uint32_t tr; |
... | ... |
@@ -1058,12 +1478,14 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], |
1058 | 1058 |
s->filter.simple, 1); |
1059 | 1059 |
|
1060 | 1060 |
if (mb->mode < MODE_I4x4) { |
1061 |
- mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y); |
|
1061 |
+ mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y, vp7); |
|
1062 | 1062 |
s->hpc.pred16x16[mode](dst[0], s->linesize); |
1063 | 1063 |
} else { |
1064 | 1064 |
uint8_t *ptr = dst[0]; |
1065 | 1065 |
uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb; |
1066 |
- uint8_t tr_top[4] = { 127, 127, 127, 127 }; |
|
1066 |
+ const uint8_t lo = vp7 ? 128 : 127; |
|
1067 |
+ const uint8_t hi = vp7 ? 128 : 129; |
|
1068 |
+ uint8_t tr_top[4] = { lo, lo, lo, lo }; |
|
1067 | 1069 |
|
1068 | 1070 |
// all blocks on the right edge of the macroblock use bottom edge |
1069 | 1071 |
// the top macroblock for their topright edge |
... | ... |
@@ -1092,17 +1514,17 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], |
1092 | 1092 |
} else if (x == 3) |
1093 | 1093 |
topright = tr_right; |
1094 | 1094 |
|
1095 |
- mode = check_intra_pred4x4_mode_emuedge(intra4x4[x], mb_x + x, mb_y + y, ©); |
|
1095 |
+ mode = check_intra_pred4x4_mode_emuedge(intra4x4[x], mb_x + x, mb_y + y, ©, vp7); |
|
1096 | 1096 |
if (copy) { |
1097 | 1097 |
dst = copy_dst + 12; |
1098 | 1098 |
linesize = 8; |
1099 | 1099 |
if (!(mb_y + y)) { |
1100 |
- copy_dst[3] = 127U; |
|
1101 |
- AV_WN32A(copy_dst+4, 127U * 0x01010101U); |
|
1100 |
+ copy_dst[3] = lo; |
|
1101 |
+ AV_WN32A(copy_dst+4, lo * 0x01010101U); |
|
1102 | 1102 |
} else { |
1103 | 1103 |
AV_COPY32(copy_dst+4, ptr+4*x-s->linesize); |
1104 | 1104 |
if (!(mb_x + x)) { |
1105 |
- copy_dst[3] = 129U; |
|
1105 |
+ copy_dst[3] = hi; |
|
1106 | 1106 |
} else { |
1107 | 1107 |
copy_dst[3] = ptr[4*x-s->linesize-1]; |
1108 | 1108 |
} |
... | ... |
@@ -1111,7 +1533,7 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], |
1111 | 1111 |
copy_dst[11] = |
1112 | 1112 |
copy_dst[19] = |
1113 | 1113 |
copy_dst[27] = |
1114 |
- copy_dst[35] = 129U; |
|
1114 |
+ copy_dst[35] = hi; |
|
1115 | 1115 |
} else { |
1116 | 1116 |
copy_dst[11] = ptr[4*x -1]; |
1117 | 1117 |
copy_dst[19] = ptr[4*x+s->linesize -1]; |
... | ... |
@@ -1142,7 +1564,7 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], |
1142 | 1142 |
} |
1143 | 1143 |
} |
1144 | 1144 |
|
1145 |
- mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y); |
|
1145 |
+ mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y, vp7); |
|
1146 | 1146 |
s->hpc.pred8x8[mode](dst[1], s->uvlinesize); |
1147 | 1147 |
s->hpc.pred8x8[mode](dst[2], s->uvlinesize); |
1148 | 1148 |
|
... | ... |
@@ -1296,7 +1718,7 @@ void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], |
1296 | 1296 |
s->put_pixels_tab[block_w == 8]); |
1297 | 1297 |
|
1298 | 1298 |
/* U/V */ |
1299 |
- if (s->profile == 3) { |
|
1299 |
+ if (s->profile == 3) { /* this block only applies VP8; it is safe to check only the profile, as VP7 profile <= 1 */ |
|
1300 | 1300 |
uvmv.x &= ~7; |
1301 | 1301 |
uvmv.y &= ~7; |
1302 | 1302 |
} |
... | ... |
@@ -1468,7 +1890,7 @@ chroma_idct_end: ; |
1468 | 1468 |
} |
1469 | 1469 |
} |
1470 | 1470 |
|
1471 |
-static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *mb, VP8FilterStrength *f ) |
|
1471 |
+static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *mb, VP8FilterStrength *f, int vp7) |
|
1472 | 1472 |
{ |
1473 | 1473 |
int interior_limit, filter_level; |
1474 | 1474 |
|
... | ... |
@@ -1495,12 +1917,12 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m |
1495 | 1495 |
|
1496 | 1496 |
f->filter_level = filter_level; |
1497 | 1497 |
f->inner_limit = interior_limit; |
1498 |
- f->inner_filter = !mb->skip || mb->mode == MODE_I4x4 || mb->mode == VP8_MVMODE_SPLIT; |
|
1498 |
+ f->inner_filter = vp7 || !mb->skip || mb->mode == MODE_I4x4 || mb->mode == VP8_MVMODE_SPLIT; |
|
1499 | 1499 |
} |
1500 | 1500 |
|
1501 |
-static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, int mb_x, int mb_y) |
|
1501 |
+static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, int mb_x, int mb_y, int vp7) |
|
1502 | 1502 |
{ |
1503 |
- int mbedge_lim, bedge_lim, hev_thresh; |
|
1503 |
+ int mbedge_lim, bedge_lim_y, bedge_lim_uv, hev_thresh; |
|
1504 | 1504 |
int filter_level = f->filter_level; |
1505 | 1505 |
int inner_limit = f->inner_limit; |
1506 | 1506 |
int inner_filter = f->inner_filter; |
... | ... |
@@ -1520,8 +1942,15 @@ static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Filter |
1520 | 1520 |
if (!filter_level) |
1521 | 1521 |
return; |
1522 | 1522 |
|
1523 |
- bedge_lim = 2*filter_level + inner_limit; |
|
1524 |
- mbedge_lim = bedge_lim + 4; |
|
1523 |
+ if (vp7) { |
|
1524 |
+ bedge_lim_y = filter_level; |
|
1525 |
+ bedge_lim_uv = 2*filter_level; |
|
1526 |
+ mbedge_lim = filter_level + 2; |
|
1527 |
+ } else { |
|
1528 |
+ bedge_lim_y = |
|
1529 |
+ bedge_lim_uv = 2*filter_level + inner_limit; |
|
1530 |
+ mbedge_lim = bedge_lim_y + 4; |
|
1531 |
+ } |
|
1525 | 1532 |
|
1526 | 1533 |
hev_thresh = hev_thresh_lut[s->keyframe][filter_level]; |
1527 | 1534 |
|
... | ... |
@@ -1532,18 +1961,21 @@ static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Filter |
1532 | 1532 |
mbedge_lim, inner_limit, hev_thresh); |
1533 | 1533 |
} |
1534 | 1534 |
|
1535 |
- if (inner_filter) { |
|
1536 |
- s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0]+ 4, linesize, bedge_lim, |
|
1537 |
- inner_limit, hev_thresh); |
|
1538 |
- s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0]+ 8, linesize, bedge_lim, |
|
1539 |
- inner_limit, hev_thresh); |
|
1540 |
- s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0]+12, linesize, bedge_lim, |
|
1541 |
- inner_limit, hev_thresh); |
|
1542 |
- s->vp8dsp.vp8_h_loop_filter8uv_inner(dst[1] + 4, dst[2] + 4, |
|
1543 |
- uvlinesize, bedge_lim, |
|
1544 |
- inner_limit, hev_thresh); |
|
1535 |
+#define H_LOOP_FILTER_16Y_INNER(cond) \ |
|
1536 |
+ if (cond && inner_filter) {\ |
|
1537 |
+ s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0]+ 4, linesize, bedge_lim_y,\ |
|
1538 |
+ inner_limit, hev_thresh);\ |
|
1539 |
+ s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0]+ 8, linesize, bedge_lim_y,\ |
|
1540 |
+ inner_limit, hev_thresh);\ |
|
1541 |
+ s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0]+12, linesize, bedge_lim_y,\ |
|
1542 |
+ inner_limit, hev_thresh);\ |
|
1543 |
+ s->vp8dsp.vp8_h_loop_filter8uv_inner(dst[1] + 4, dst[2] + 4,\ |
|
1544 |
+ uvlinesize, bedge_lim_uv,\ |
|
1545 |
+ inner_limit, hev_thresh);\ |
|
1545 | 1546 |
} |
1546 | 1547 |
|
1548 |
+ H_LOOP_FILTER_16Y_INNER(!vp7) |
|
1549 |
+ |
|
1547 | 1550 |
if (mb_y) { |
1548 | 1551 |
s->vp8dsp.vp8_v_loop_filter16y(dst[0], linesize, |
1549 | 1552 |
mbedge_lim, inner_limit, hev_thresh); |
... | ... |
@@ -1553,19 +1985,21 @@ static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Filter |
1553 | 1553 |
|
1554 | 1554 |
if (inner_filter) { |
1555 | 1555 |
s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0]+ 4*linesize, |
1556 |
- linesize, bedge_lim, |
|
1556 |
+ linesize, bedge_lim_y, |
|
1557 | 1557 |
inner_limit, hev_thresh); |
1558 | 1558 |
s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0]+ 8*linesize, |
1559 |
- linesize, bedge_lim, |
|
1559 |
+ linesize, bedge_lim_y, |
|
1560 | 1560 |
inner_limit, hev_thresh); |
1561 | 1561 |
s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0]+12*linesize, |
1562 |
- linesize, bedge_lim, |
|
1562 |
+ linesize, bedge_lim_y, |
|
1563 | 1563 |
inner_limit, hev_thresh); |
1564 | 1564 |
s->vp8dsp.vp8_v_loop_filter8uv_inner(dst[1] + 4 * uvlinesize, |
1565 | 1565 |
dst[2] + 4 * uvlinesize, |
1566 |
- uvlinesize, bedge_lim, |
|
1566 |
+ uvlinesize, bedge_lim_uv, |
|
1567 | 1567 |
inner_limit, hev_thresh); |
1568 | 1568 |
} |
1569 |
+ |
|
1570 |
+ H_LOOP_FILTER_16Y_INNER(vp7) |
|
1569 | 1571 |
} |
1570 | 1572 |
|
1571 | 1573 |
static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8FilterStrength *f, int mb_x, int mb_y) |
... | ... |
@@ -1600,8 +2034,9 @@ static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8Fi |
1600 | 1600 |
} |
1601 | 1601 |
|
1602 | 1602 |
#define MARGIN (16 << 2) |
1603 |
-static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
|
1604 |
- VP8Frame *prev_frame) |
|
1603 |
+static av_always_inline |
|
1604 |
+void decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
|
1605 |
+ VP8Frame *prev_frame, int vp7) |
|
1605 | 1606 |
{ |
1606 | 1607 |
VP8Context *s = avctx->priv_data; |
1607 | 1608 |
int mb_x, mb_y; |
... | ... |
@@ -1621,7 +2056,7 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
1621 | 1621 |
AV_WN32A((mb-s->mb_width-1)->intra4x4_pred_mode_top, DC_PRED*0x01010101); |
1622 | 1622 |
decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy, |
1623 | 1623 |
prev_frame && prev_frame->seg_map ? |
1624 |
- prev_frame->seg_map->data + mb_xy : NULL, 1); |
|
1624 |
+ prev_frame->seg_map->data + mb_xy : NULL, 1, vp7); |
|
1625 | 1625 |
s->mv_min.x -= 64; |
1626 | 1626 |
s->mv_max.x -= 64; |
1627 | 1627 |
} |
... | ... |
@@ -1630,6 +2065,22 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
1630 | 1630 |
} |
1631 | 1631 |
} |
1632 | 1632 |
|
1633 |
+#if CONFIG_VP7_DECODER |
|
1634 |
+static void vp7_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
|
1635 |
+ VP8Frame *prev_frame) |
|
1636 |
+{ |
|
1637 |
+ decode_mv_mb_modes(avctx, curframe, prev_frame, 1); |
|
1638 |
+} |
|
1639 |
+#endif |
|
1640 |
+ |
|
1641 |
+#if CONFIG_VP8_DECODER |
|
1642 |
+static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
|
1643 |
+ VP8Frame *prev_frame) |
|
1644 |
+{ |
|
1645 |
+ decode_mv_mb_modes(avctx, curframe, prev_frame, 0); |
|
1646 |
+} |
|
1647 |
+#endif |
|
1648 |
+ |
|
1633 | 1649 |
#if HAVE_THREADS |
1634 | 1650 |
#define check_thread_pos(td, otd, mb_x_check, mb_y_check)\ |
1635 | 1651 |
do {\ |
... | ... |
@@ -1667,8 +2118,8 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, |
1667 | 1667 |
#define update_pos(td, mb_y, mb_x) |
1668 | 1668 |
#endif |
1669 | 1669 |
|
1670 |
-static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
|
1671 |
- int jobnr, int threadnr) |
|
1670 |
+static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
|
1671 |
+ int jobnr, int threadnr, int vp7) |
|
1672 | 1672 |
{ |
1673 | 1673 |
VP8Context *s = avctx->priv_data; |
1674 | 1674 |
VP8ThreadData *prev_td, *next_td, *td = &s->thread_data[threadnr]; |
... | ... |
@@ -1700,7 +2151,8 @@ static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
1700 | 1700 |
AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); |
1701 | 1701 |
} |
1702 | 1702 |
|
1703 |
- memset(td->left_nnz, 0, sizeof(td->left_nnz)); |
|
1703 |
+ if (!vp7 || mb_y == 0) |
|
1704 |
+ memset(td->left_nnz, 0, sizeof(td->left_nnz)); |
|
1704 | 1705 |
|
1705 | 1706 |
s->mv_min.x = -MARGIN; |
1706 | 1707 |
s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; |
... | ... |
@@ -1709,9 +2161,9 @@ static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
1709 | 1709 |
// Wait for previous thread to read mb_x+2, and reach mb_y-1. |
1710 | 1710 |
if (prev_td != td) { |
1711 | 1711 |
if (threadnr != 0) { |
1712 |
- check_thread_pos(td, prev_td, mb_x+1, mb_y-1); |
|
1712 |
+ check_thread_pos(td, prev_td, mb_x+(vp7?2:1), mb_y-(vp7?2:1)); |
|
1713 | 1713 |
} else { |
1714 |
- check_thread_pos(td, prev_td, (s->mb_width+3) + (mb_x+1), mb_y-1); |
|
1714 |
+ check_thread_pos(td, prev_td, (s->mb_width+3) + (mb_x+(vp7?2:1)), mb_y-(vp7?2:1)); |
|
1715 | 1715 |
} |
1716 | 1716 |
} |
1717 | 1717 |
|
... | ... |
@@ -1721,15 +2173,15 @@ static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
1721 | 1721 |
if (!s->mb_layout) |
1722 | 1722 |
decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy, |
1723 | 1723 |
prev_frame && prev_frame->seg_map ? |
1724 |
- prev_frame->seg_map->data + mb_xy : NULL, 0); |
|
1724 |
+ prev_frame->seg_map->data + mb_xy : NULL, 0, vp7); |
|
1725 | 1725 |
|
1726 | 1726 |
prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS); |
1727 | 1727 |
|
1728 | 1728 |
if (!mb->skip) |
1729 |
- decode_mb_coeffs(s, td, c, mb, s->top_nnz[mb_x], td->left_nnz); |
|
1729 |
+ decode_mb_coeffs(s, td, c, mb, s->top_nnz[mb_x], td->left_nnz, vp7); |
|
1730 | 1730 |
|
1731 | 1731 |
if (mb->mode <= MODE_I4x4) |
1732 |
- intra_predict(s, td, dst, mb, mb_x, mb_y); |
|
1732 |
+ intra_predict(s, td, dst, mb, mb_x, mb_y, vp7); |
|
1733 | 1733 |
else |
1734 | 1734 |
inter_predict(s, td, dst, mb, mb_x, mb_y); |
1735 | 1735 |
|
... | ... |
@@ -1749,7 +2201,7 @@ static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
1749 | 1749 |
} |
1750 | 1750 |
|
1751 | 1751 |
if (s->deblock_filter) |
1752 |
- filter_level_for_mb(s, mb, &td->filter_strength[mb_x]); |
|
1752 |
+ filter_level_for_mb(s, mb, &td->filter_strength[mb_x], vp7); |
|
1753 | 1753 |
|
1754 | 1754 |
if (s->deblock_filter && num_jobs != 1 && threadnr == num_jobs-1) { |
1755 | 1755 |
if (s->filter.simple) |
... | ... |
@@ -1774,8 +2226,24 @@ static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
1774 | 1774 |
} |
1775 | 1775 |
} |
1776 | 1776 |
|
1777 |
-static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata, |
|
1778 |
- int jobnr, int threadnr) |
|
1777 |
+#if CONFIG_VP7_DECODER |
|
1778 |
+static void vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
|
1779 |
+ int jobnr, int threadnr) |
|
1780 |
+{ |
|
1781 |
+ decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1); |
|
1782 |
+} |
|
1783 |
+#endif |
|
1784 |
+ |
|
1785 |
+#if CONFIG_VP8_DECODER |
|
1786 |
+static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, |
|
1787 |
+ int jobnr, int threadnr) |
|
1788 |
+{ |
|
1789 |
+ decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0); |
|
1790 |
+} |
|
1791 |
+#endif |
|
1792 |
+ |
|
1793 |
+static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, |
|
1794 |
+ int jobnr, int threadnr, int vp7) |
|
1779 | 1795 |
{ |
1780 | 1796 |
VP8Context *s = avctx->priv_data; |
1781 | 1797 |
VP8ThreadData *td = &s->thread_data[threadnr]; |
... | ... |
@@ -1819,7 +2287,7 @@ static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata, |
1819 | 1819 |
if (s->filter.simple) |
1820 | 1820 |
filter_mb_simple(s, dst[0], f, mb_x, mb_y); |
1821 | 1821 |
else |
1822 |
- filter_mb(s, dst, f, mb_x, mb_y); |
|
1822 |
+ filter_mb(s, dst, f, mb_x, mb_y, vp7); |
|
1823 | 1823 |
dst[0] += 16; |
1824 | 1824 |
dst[1] += 8; |
1825 | 1825 |
dst[2] += 8; |
... | ... |
@@ -1828,6 +2296,22 @@ static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata, |
1828 | 1828 |
} |
1829 | 1829 |
} |
1830 | 1830 |
|
1831 |
+#if CONFIG_VP7_DECODER |
|
1832 |
+static void vp7_filter_mb_row(AVCodecContext *avctx, void *tdata, |
|
1833 |
+ int jobnr, int threadnr) |
|
1834 |
+{ |
|
1835 |
+ filter_mb_row(avctx, tdata, jobnr, threadnr, 1); |
|
1836 |
+} |
|
1837 |
+#endif |
|
1838 |
+ |
|
1839 |
+#if CONFIG_VP8_DECODER |
|
1840 |
+static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata, |
|
1841 |
+ int jobnr, int threadnr) |
|
1842 |
+{ |
|
1843 |
+ filter_mb_row(avctx, tdata, jobnr, threadnr, 0); |
|
1844 |
+} |
|
1845 |
+#endif |
|
1846 |
+ |
|
1831 | 1847 |
static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, |
1832 | 1848 |
int jobnr, int threadnr) |
1833 | 1849 |
{ |
... | ... |
@@ -1840,9 +2324,9 @@ static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, |
1840 | 1840 |
for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) { |
1841 | 1841 |
if (mb_y >= s->mb_height) break; |
1842 | 1842 |
td->thread_mb_pos = mb_y<<16; |
1843 |
- vp8_decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr); |
|
1843 |
+ s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr); |
|
1844 | 1844 |
if (s->deblock_filter) |
1845 |
- vp8_filter_mb_row(avctx, tdata, jobnr, threadnr); |
|
1845 |
+ s->filter_mb_row(avctx, tdata, jobnr, threadnr); |
|
1846 | 1846 |
update_pos(td, mb_y, INT_MAX & 0xFFFF); |
1847 | 1847 |
|
1848 | 1848 |
s->mv_min.y -= 64; |
... | ... |
@@ -1863,7 +2347,7 @@ int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, |
1863 | 1863 |
enum AVDiscard skip_thresh; |
1864 | 1864 |
VP8Frame *av_uninit(curframe), *prev_frame; |
1865 | 1865 |
|
1866 |
- if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) |
|
1866 |
+ if ((ret = VPX(s->vp7, decode_frame_header)(s, avpkt->data, avpkt->size)) < 0) |
|
1867 | 1867 |
goto err; |
1868 | 1868 |
|
1869 | 1869 |
prev_frame = s->framep[VP56_FRAME_CURRENT]; |
... | ... |
@@ -1947,7 +2431,7 @@ int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, |
1947 | 1947 |
if (prev_frame && s->segmentation.enabled && |
1948 | 1948 |
!s->segmentation.update_map) |
1949 | 1949 |
ff_thread_await_progress(&prev_frame->tf, 1, 0); |
1950 |
- vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); |
|
1950 |
+ VPX(s->vp7, decode_mv_mb_modes)(avctx, curframe, prev_frame); |
|
1951 | 1951 |
} |
1952 | 1952 |
|
1953 | 1953 |
if (avctx->active_thread_type == FF_THREAD_FRAME) |
... | ... |
@@ -2015,12 +2499,16 @@ av_cold int ff_vp8_decode_init(AVCodecContext *avctx) |
2015 | 2015 |
int ret; |
2016 | 2016 |
|
2017 | 2017 |
s->avctx = avctx; |
2018 |
+ s->vp7 = avctx->codec->id == AV_CODEC_ID_VP7; |
|
2018 | 2019 |
avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
2019 | 2020 |
avctx->internal->allocate_progress = 1; |
2020 | 2021 |
|
2021 | 2022 |
ff_videodsp_init(&s->vdsp, 8); |
2022 |
- ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1); |
|
2023 |
- ff_vp8dsp_init(&s->vp8dsp, 0); |
|
2023 |
+ ff_h264_pred_init(&s->hpc, s->vp7 ? AV_CODEC_ID_VP7 : AV_CODEC_ID_VP8, 8, 1); |
|
2024 |
+ ff_vp8dsp_init(&s->vp8dsp, s->vp7); |
|
2025 |
+ |
|
2026 |
+ s->decode_mb_row_no_filter = VPX(s->vp7, decode_mb_row_no_filter); |
|
2027 |
+ s->filter_mb_row = VPX(s->vp7, filter_mb_row); |
|
2024 | 2028 |
|
2025 | 2029 |
if ((ret = vp8_init_frames(s)) < 0) { |
2026 | 2030 |
ff_vp8_decode_free(avctx); |
... | ... |
@@ -2030,6 +2518,7 @@ av_cold int ff_vp8_decode_init(AVCodecContext *avctx) |
2030 | 2030 |
return 0; |
2031 | 2031 |
} |
2032 | 2032 |
|
2033 |
+#if CONFIG_VP8_DECODER |
|
2033 | 2034 |
static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx) |
2034 | 2035 |
{ |
2035 | 2036 |
VP8Context *s = avctx->priv_data; |
... | ... |
@@ -2080,7 +2569,24 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo |
2080 | 2080 |
|
2081 | 2081 |
return 0; |
2082 | 2082 |
} |
2083 |
+#endif |
|
2083 | 2084 |
|
2085 |
+#if CONFIG_VP7_DECODER |
|
2086 |
+AVCodec ff_vp7_decoder = { |
|
2087 |
+ .name = "vp7", |
|
2088 |
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP7"), |
|
2089 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
2090 |
+ .id = AV_CODEC_ID_VP7, |
|
2091 |
+ .priv_data_size = sizeof(VP8Context), |
|
2092 |
+ .init = ff_vp8_decode_init, |
|
2093 |
+ .close = ff_vp8_decode_free, |
|
2094 |
+ .decode = ff_vp8_decode_frame, |
|
2095 |
+ .capabilities = CODEC_CAP_DR1, |
|
2096 |
+ .flush = vp8_decode_flush, |
|
2097 |
+}; |
|
2098 |
+#endif |
|
2099 |
+ |
|
2100 |
+#if CONFIG_VP8_DECODER |
|
2084 | 2101 |
AVCodec ff_vp8_decoder = { |
2085 | 2102 |
.name = "vp8", |
2086 | 2103 |
.long_name = NULL_IF_CONFIG_SMALL("On2 VP8"), |
... | ... |
@@ -2095,4 +2601,5 @@ AVCodec ff_vp8_decoder = { |
2095 | 2095 |
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp8_decode_init_thread_copy), |
2096 | 2096 |
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context), |
2097 | 2097 |
}; |
2098 |
+#endif |
|
2098 | 2099 |
|
... | ... |
@@ -238,6 +238,7 @@ typedef struct VP8Context { |
238 | 238 |
uint8_t pred8x8c[3]; |
239 | 239 |
uint8_t token[4][16][3][NUM_DCT_TOKENS-1]; |
240 | 240 |
uint8_t mvc[2][19]; |
241 |
+ uint8_t scan[16]; |
|
241 | 242 |
} prob[2]; |
242 | 243 |
|
243 | 244 |
VP8Macroblock *macroblocks_base; |
... | ... |
@@ -271,6 +272,31 @@ typedef struct VP8Context { |
271 | 271 |
* 1 -> Macroblocks for entire frame alloced (sliced thread). |
272 | 272 |
*/ |
273 | 273 |
int mb_layout; |
274 |
+ |
|
275 |
+ void (*decode_mb_row_no_filter)(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr); |
|
276 |
+ void (*filter_mb_row)(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr); |
|
277 |
+ |
|
278 |
+ int vp7; |
|
279 |
+ |
|
280 |
+ /** |
|
281 |
+ * Fade bit present in bitstream (VP7) |
|
282 |
+ */ |
|
283 |
+ int fade_present; |
|
284 |
+ |
|
285 |
+ /** |
|
286 |
+ * Interframe DC prediction (VP7) |
|
287 |
+ * [0] VP56_FRAME_PREVIOUS |
|
288 |
+ * [1] VP56_FRAME_GOLDEN |
|
289 |
+ */ |
|
290 |
+ uint16_t inter_dc_pred[2][2]; |
|
291 |
+ |
|
292 |
+ /** |
|
293 |
+ * Macroblock features (VP7) |
|
294 |
+ */ |
|
295 |
+ uint8_t feature_enabled[4]; |
|
296 |
+ uint8_t feature_present_prob[4]; |
|
297 |
+ uint8_t feature_index_prob[4][3]; |
|
298 |
+ uint8_t feature_value[4][4]; |
|
274 | 299 |
} VP8Context; |
275 | 300 |
|
276 | 301 |
int ff_vp8_decode_init(AVCodecContext *avctx); |
... | ... |
@@ -30,6 +30,14 @@ |
30 | 30 |
#include "vp8.h" |
31 | 31 |
#include "h264pred.h" |
32 | 32 |
|
33 |
+static const uint8_t vp7_pred4x4_mode[] = |
|
34 |
+{ |
|
35 |
+ [DC_PRED8x8] = DC_PRED, |
|
36 |
+ [VERT_PRED8x8] = TM_VP8_PRED, |
|
37 |
+ [HOR_PRED8x8] = TM_VP8_PRED, |
|
38 |
+ [PLANE_PRED8x8] = TM_VP8_PRED, |
|
39 |
+}; |
|
40 |
+ |
|
33 | 41 |
static const uint8_t vp8_pred4x4_mode[] = |
34 | 42 |
{ |
35 | 43 |
[DC_PRED8x8] = DC_PRED, |
... | ... |
@@ -54,6 +62,63 @@ static const int8_t vp8_pred16x16_tree_inter[4][2] = |
54 | 54 |
{ -PLANE_PRED8x8, -MODE_I4x4 }, // '110', '111' |
55 | 55 |
}; |
56 | 56 |
|
57 |
+typedef struct { |
|
58 |
+ int8_t yoffset; |
|
59 |
+ int8_t xoffset; |
|
60 |
+ uint8_t subblock; |
|
61 |
+ uint8_t score; |
|
62 |
+} VP7MVPred; |
|
63 |
+ |
|
64 |
+#define VP7_MV_PRED_COUNT 12 |
|
65 |
+static const VP7MVPred vp7_mv_pred[VP7_MV_PRED_COUNT] = { |
|
66 |
+ { -1, 0, 12, 8 }, |
|
67 |
+ { 0, -1, 3, 8 }, |
|
68 |
+ { -1, -1, 15, 2 }, |
|
69 |
+ { -1, 1, 12, 2 }, |
|
70 |
+ { -2, 0, 12, 2 }, |
|
71 |
+ { 0, -2, 3, 2 }, |
|
72 |
+ { -1, -2, 15, 1 }, |
|
73 |
+ { -2, -1, 15, 1 }, |
|
74 |
+ { -2, 1, 12, 1 }, |
|
75 |
+ { -1, 2, 12, 1 }, |
|
76 |
+ { -2, -2, 15, 1 }, |
|
77 |
+ { -2, 2, 12, 1 }, |
|
78 |
+}; |
|
79 |
+ |
|
80 |
+static const int vp7_mode_contexts[31][4] = { |
|
81 |
+ { 3, 3, 1, 246 }, |
|
82 |
+ { 7, 89, 66, 239 }, |
|
83 |
+ { 10, 90, 78, 238 }, |
|
84 |
+ { 14, 118, 95, 241 }, |
|
85 |
+ { 14, 123, 106, 238 }, |
|
86 |
+ { 20, 140, 109, 240 }, |
|
87 |
+ { 13, 155, 103, 238 }, |
|
88 |
+ { 21, 158, 99, 240 }, |
|
89 |
+ { 27, 82, 108, 232 }, |
|
90 |
+ { 19, 99, 123, 217 }, |
|
91 |
+ { 45, 139, 148, 236 }, |
|
92 |
+ { 50, 117, 144, 235 }, |
|
93 |
+ { 57, 128, 164, 238 }, |
|
94 |
+ { 69, 139, 171, 239 }, |
|
95 |
+ { 74, 154, 179, 238 }, |
|
96 |
+ { 112, 165, 186, 242 }, |
|
97 |
+ { 98, 143, 185, 245 }, |
|
98 |
+ { 105, 153, 190, 250 }, |
|
99 |
+ { 124, 167, 192, 245 }, |
|
100 |
+ { 131, 186, 203, 246 }, |
|
101 |
+ { 59, 184, 222, 224 }, |
|
102 |
+ { 148, 215, 214, 213 }, |
|
103 |
+ { 137, 211, 210, 219 }, |
|
104 |
+ { 190, 227, 128, 228 }, |
|
105 |
+ { 183, 228, 128, 228 }, |
|
106 |
+ { 194, 234, 128, 228 }, |
|
107 |
+ { 202, 236, 128, 228 }, |
|
108 |
+ { 205, 240, 128, 228 }, |
|
109 |
+ { 205, 244, 128, 228 }, |
|
110 |
+ { 225, 246, 128, 228 }, |
|
111 |
+ { 233, 251, 128, 228 }, |
|
112 |
+}; |
|
113 |
+ |
|
57 | 114 |
static const int vp8_mode_contexts[6][4] = { |
58 | 115 |
{ 7, 1, 1, 143 }, |
59 | 116 |
{ 14, 18, 14, 107 }, |
... | ... |
@@ -85,6 +150,8 @@ static const uint8_t vp8_mbfirstidx[4][16] = { |
85 | 85 |
static const uint8_t vp8_mbsplit_count[4] = { 2, 2, 4, 16 }; |
86 | 86 |
static const uint8_t vp8_mbsplit_prob[3] = { 110, 111, 150 }; |
87 | 87 |
|
88 |
+static const uint8_t vp7_submv_prob[3] = { 180, 162, 25 }; |
|
89 |
+ |
|
88 | 90 |
static const uint8_t vp8_submv_prob[5][3] = { |
89 | 91 |
{ 147, 136, 18 }, |
90 | 92 |
{ 106, 145, 1 }, |
... | ... |
@@ -670,11 +737,22 @@ static const uint8_t vp8_mv_update_prob[2][19] = { |
670 | 670 |
{ 237, |
671 | 671 |
246, |
672 | 672 |
253, 253, 254, 254, 254, 254, 254, |
673 |
- 254, 254, 254, 254, 254, 250, 250, 252, 254, 254 }, |
|
673 |
+ 254, 254, 254, 254, 254, 250, 250, 252, /* VP8 only: */ 254, 254 }, |
|
674 | 674 |
{ 231, |
675 | 675 |
243, |
676 | 676 |
245, 253, 254, 254, 254, 254, 254, |
677 |
- 254, 254, 254, 254, 254, 251, 251, 254, 254, 254 } |
|
677 |
+ 254, 254, 254, 254, 254, 251, 251, 254, /* VP8 only: */ 254, 254 } |
|
678 |
+}; |
|
679 |
+ |
|
680 |
+static const uint8_t vp7_mv_default_prob[2][17] = { |
|
681 |
+ { 162, |
|
682 |
+ 128, |
|
683 |
+ 225, 146, 172, 147, 214, 39, 156, |
|
684 |
+ 247, 210, 135, 68, 138, 220, 239, 246 }, |
|
685 |
+ { 164, |
|
686 |
+ 128, |
|
687 |
+ 204, 170, 119, 235, 140, 230, 228, |
|
688 |
+ 244, 184, 201, 44, 173, 221, 239, 253 } |
|
678 | 689 |
}; |
679 | 690 |
|
680 | 691 |
static const uint8_t vp8_mv_default_prob[2][19] = { |
... | ... |
@@ -688,4 +766,60 @@ static const uint8_t vp8_mv_default_prob[2][19] = { |
688 | 688 |
128, 130, 130, 74, 148, 180, 203, 236, 254, 254 } |
689 | 689 |
}; |
690 | 690 |
|
691 |
+static const uint8_t vp7_feature_value_size[2][4] = { |
|
692 |
+ {7, 6, 0, 8}, |
|
693 |
+ {7, 6, 0, 5}, |
|
694 |
+}; |
|
695 |
+ |
|
696 |
+static const int8_t vp7_feature_index_tree[4][2] = |
|
697 |
+{ |
|
698 |
+ { 1, 2 }, |
|
699 |
+ { -0, -1 }, // '00', '01' |
|
700 |
+ { -2, -3 }, // '10', '11' |
|
701 |
+}; |
|
702 |
+ |
|
703 |
+static const uint16_t vp7_ydc_qlookup[] = { |
|
704 |
+ 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
|
705 |
+ 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, |
|
706 |
+ 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, |
|
707 |
+ 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 53, 54, 56, |
|
708 |
+ 57, 58, 59, 60, 62, 63, 65, 66, 68, 70, 72, 74, 76, 79, 81, 84, |
|
709 |
+ 87, 90, 93, 96, 100, 104, 108, 112, 116, 121, 126, 131, 136, 142, 148, 154, |
|
710 |
+ 160, 167, 174, 182, 189, 198, 206, 215, 224, 234, 244, 254, 265, 277, 288, 301, |
|
711 |
+ 313, 327, 340, 355, 370, 385, 401, 417, 434, 452, 470, 489, 509, 529, 550, 572, |
|
712 |
+}; |
|
713 |
+ |
|
714 |
+static const uint16_t vp7_yac_qlookup[] = { |
|
715 |
+ 4, 4, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, |
|
716 |
+ 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41, |
|
717 |
+ 42, 44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 61, |
|
718 |
+ 62, 63, 64, 65, 67, 68, 69, 70, 72, 73, 75, 76, 78, 80, 82, 84, |
|
719 |
+ 86, 88, 91, 93, 96, 99, 102, 105, 109, 112, 116, 121, 125, 130, 135, 140, |
|
720 |
+ 146, 152, 158, 165, 172, 180, 188, 196, 205, 214, 224, 234, 245, 256, 268, 281, |
|
721 |
+ 294, 308, 322, 337, 353, 369, 386, 404, 423, 443, 463, 484, 506, 529, 553, 578, |
|
722 |
+ 604, 631, 659, 688, 718, 749, 781, 814, 849, 885, 922, 960, 1000, 1041, 1083, 1127, |
|
723 |
+}; |
|
724 |
+ |
|
725 |
+static const uint16_t vp7_y2dc_qlookup[] = { |
|
726 |
+ 7, 9, 11, 13, 15, 17, 19, 21, 23, 26, 28, 30, 33, 35, 37, 39, |
|
727 |
+ 42, 44, 46, 48, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 70, 72, |
|
728 |
+ 74, 75, 77, 78, 80, 81, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, |
|
729 |
+ 95, 96, 97, 99, 100, 101, 102, 104, 105, 106, 108, 109, 111, 113, 114, 116, |
|
730 |
+ 118, 120, 123, 125, 128, 131, 134, 137, 140, 144, 148, 152, 156, 161, 166, 171, |
|
731 |
+ 176, 182, 188, 195, 202, 209, 217, 225, 234, 243, 253, 263, 274, 285, 297, 309, |
|
732 |
+ 322, 336, 350, 365, 381, 397, 414, 432, 450, 470, 490, 511, 533, 556, 579, 604, |
|
733 |
+ 630, 656, 684, 713, 742, 773, 805, 838, 873, 908, 945, 983, 1022, 1063, 1105, 1148, |
|
734 |
+}; |
|
735 |
+ |
|
736 |
+static const uint16_t vp7_y2ac_qlookup[] = { |
|
737 |
+ 7, 9, 11, 13, 16, 18, 21, 24, 26, 29, 32, 35, 38, 41, 43, 46, |
|
738 |
+ 49, 52, 55, 58, 61, 64, 66, 69, 72, 74, 77, 79, 82, 84, 86, 88, |
|
739 |
+ 91, 93, 95, 97, 98, 100, 102, 104, 105, 107, 109, 110, 112, 113, 115, 116, |
|
740 |
+ 117, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 136, 138, 141, 143, 146, |
|
741 |
+ 149, 152, 155, 158, 162, 166, 171, 175, 180, 185, 191, 197, 204, 210, 218, 226, |
|
742 |
+ 234, 243, 252, 262, 273, 284, 295, 308, 321, 335, 350, 365, 381, 398, 416, 435, |
|
743 |
+ 455, 476, 497, 520, 544, 569, 595, 622, 650, 680, 711, 743, 776, 811, 848, 885, |
|
744 |
+ 925, 965, 1008, 1052, 1097, 1144, 1193, 1244, 1297, 1351, 1407, 1466, 1526, 1588, 1652, 1719, |
|
745 |
+}; |
|
746 |
+ |
|
691 | 747 |
#endif /* AVCODEC_VP8DATA_H */ |
... | ... |
@@ -43,6 +43,7 @@ OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o |
43 | 43 |
OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_init.o |
44 | 44 |
OBJS-$(CONFIG_VORBIS_DECODER) += x86/vorbisdsp_init.o |
45 | 45 |
OBJS-$(CONFIG_VP6_DECODER) += x86/vp6dsp_init.o |
46 |
+OBJS-$(CONFIG_VP7_DECODER) += x86/vp8dsp_init.o |
|
46 | 47 |
OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp_init.o |
47 | 48 |
OBJS-$(CONFIG_VP9_DECODER) += x86/vp9dsp_init.o |
48 | 49 |
OBJS-$(CONFIG_WEBP_DECODER) += x86/vp8dsp_init.o |
... | ... |
@@ -111,6 +112,8 @@ YASM-OBJS-$(CONFIG_V210_DECODER) += x86/v210.o |
111 | 111 |
YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp.o |
112 | 112 |
YASM-OBJS-$(CONFIG_VORBIS_DECODER) += x86/vorbisdsp.o |
113 | 113 |
YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp6dsp.o |
114 |
+YASM-OBJS-$(CONFIG_VP7_DECODER) += x86/vp8dsp.o \ |
|
115 |
+ x86/vp8dsp_loopfilter.o |
|
114 | 116 |
YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o \ |
115 | 117 |
x86/vp8dsp_loopfilter.o |
116 | 118 |
YASM-OBJS-$(CONFIG_VP9_DECODER) += x86/vp9intrapred.o \ |
... | ... |
@@ -195,7 +195,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, |
195 | 195 |
h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmx; |
196 | 196 |
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmx; |
197 | 197 |
} |
198 |
- if (codec_id == AV_CODEC_ID_VP8) { |
|
198 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) { |
|
199 | 199 |
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_mmx; |
200 | 200 |
h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_mmx; |
201 | 201 |
h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_mmx; |
... | ... |
@@ -231,7 +231,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, |
231 | 231 |
h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_8_mmxext; |
232 | 232 |
h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_8_mmxext; |
233 | 233 |
h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_8_mmxext; |
234 |
- if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_H264) { |
|
234 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_H264) { |
|
235 | 235 |
h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_8_mmxext; |
236 | 236 |
} |
237 | 237 |
if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { |
... | ... |
@@ -246,7 +246,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, |
246 | 246 |
h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_8_mmxext; |
247 | 247 |
} |
248 | 248 |
} |
249 |
- if (codec_id == AV_CODEC_ID_VP8) { |
|
249 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) { |
|
250 | 250 |
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_mmxext; |
251 | 251 |
h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_8_mmxext; |
252 | 252 |
h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_mmxext; |
... | ... |
@@ -276,7 +276,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, |
276 | 276 |
h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_sse2; |
277 | 277 |
h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_sse2; |
278 | 278 |
h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_sse2; |
279 |
- if (codec_id == AV_CODEC_ID_VP8) { |
|
279 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) { |
|
280 | 280 |
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_sse2; |
281 | 281 |
h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_sse2; |
282 | 282 |
} else { |
... | ... |
@@ -307,7 +307,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, |
307 | 307 |
h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_ssse3; |
308 | 308 |
h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_8_ssse3; |
309 | 309 |
h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_ssse3; |
310 |
- if (codec_id == AV_CODEC_ID_VP8) { |
|
310 |
+ if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) { |
|
311 | 311 |
h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_ssse3; |
312 | 312 |
h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_ssse3; |
313 | 313 |
} else { |