From fb0cb11f09c4f121edfee6eb5244b527cd0cb991 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 28 Dec 2012 06:19:12 +0100 Subject: cavsdec: export picture type in the output frame --- libavcodec/cavs.h | 1 - libavcodec/cavsdec.c | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h index 2032441351..26f1e9c7af 100644 --- a/libavcodec/cavs.h +++ b/libavcodec/cavs.h @@ -172,7 +172,6 @@ typedef struct AVSContext { int aspect_ratio; int mb_width, mb_height; int width, height; - int pic_type; int stream_revision; ///<0 for samples from 2006, 1 for rm52j encoder int progressive; int pic_structure; diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index e09802b6b1..cef6b953a5 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -632,7 +632,7 @@ static inline void set_mv_intra(AVSContext *h) set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); h->mv[MV_BWD_X0] = ff_cavs_intra_mv; set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); - if (h->pic_type != AV_PICTURE_TYPE_B) + if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) h->col_type_base[h->mbidx] = I_8X8; } @@ -671,7 +671,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code) ff_cavs_modify_mb_i(h, &pred_mode_uv); /* get coded block pattern */ - if (h->pic_type == AV_PICTURE_TYPE_I) + if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) cbp_code = get_ue_golomb(gb); if (cbp_code > 63) { av_log(h->avctx, AV_LOG_ERROR, "illegal intra cbp\n"); @@ -889,7 +889,7 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) h->qp = get_bits(gb, 6); } /* inter frame or second slice can have weighting params */ - if ((h->pic_type != AV_PICTURE_TYPE_I) || + if ((h->cur.f->pict_type != AV_PICTURE_TYPE_I) || (!h->pic_structure && h->mby >= h->mb_width / 2)) if (get_bits1(gb)) { //slice_weighting_flag av_log(h->avctx, AV_LOG_ERROR, @@ -933,17 +933,17 @@ static int decode_pic(AVSContext *h) skip_bits(&h->gb, 16);//bbv_dwlay if (h->stc == PIC_PB_START_CODE) { - h->pic_type = get_bits(&h->gb, 2) + AV_PICTURE_TYPE_I; - if (h->pic_type > AV_PICTURE_TYPE_B) { + h->cur.f->pict_type = get_bits(&h->gb, 2) + AV_PICTURE_TYPE_I; + if (h->cur.f->pict_type > AV_PICTURE_TYPE_B) { av_log(h->avctx, AV_LOG_ERROR, "illegal picture type\n"); return -1; } /* make sure we have the reference frames we need */ if (!h->DPB[0].f->data[0] || - (!h->DPB[1].f->data[0] && h->pic_type == AV_PICTURE_TYPE_B)) + (!h->DPB[1].f->data[0] && h->cur.f->pict_type == AV_PICTURE_TYPE_B)) return -1; } else { - h->pic_type = AV_PICTURE_TYPE_I; + h->cur.f->pict_type = AV_PICTURE_TYPE_I; if (get_bits1(&h->gb)) skip_bits(&h->gb, 24);//time_code /* old sample clips were all progressive and no low_delay, @@ -973,7 +973,7 @@ static int decode_pic(AVSContext *h) h->cur.poc = get_bits(&h->gb, 8) * 2; /* get temporal distances and MV scaling factors */ - if (h->pic_type != AV_PICTURE_TYPE_B) { + if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { h->dist[0] = (h->cur.poc - h->DPB[0].poc + 512) % 512; } else { h->dist[0] = (h->DPB[0].poc - h->cur.poc + 512) % 512; @@ -981,7 +981,7 @@ static int decode_pic(AVSContext *h) h->dist[1] = (h->cur.poc - h->DPB[1].poc + 512) % 512; h->scale_den[0] = h->dist[0] ? 512/h->dist[0] : 0; h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0; - if (h->pic_type == AV_PICTURE_TYPE_B) { + if (h->cur.f->pict_type == AV_PICTURE_TYPE_B) { h->sym_factor = h->dist[0] * h->scale_den[1]; } else { h->direct_den[0] = h->dist[0] ? 16384 / h->dist[0] : 0; @@ -1000,12 +1000,12 @@ static int decode_pic(AVSContext *h) skip_bits1(&h->gb); //repeat_first_field h->qp_fixed = get_bits1(&h->gb); h->qp = get_bits(&h->gb, 6); - if (h->pic_type == AV_PICTURE_TYPE_I) { + if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) { if (!h->progressive && !h->pic_structure) skip_bits1(&h->gb);//what is this? skip_bits(&h->gb, 4); //reserved bits } else { - if (!(h->pic_type == AV_PICTURE_TYPE_B && h->pic_structure == 1)) + if (!(h->cur.f->pict_type == AV_PICTURE_TYPE_B && h->pic_structure == 1)) h->ref_flag = get_bits1(&h->gb); skip_bits(&h->gb, 4); //reserved bits h->skip_mode_flag = get_bits1(&h->gb); @@ -1017,12 +1017,12 @@ static int decode_pic(AVSContext *h) } else { h->alpha_offset = h->beta_offset = 0; } - if (h->pic_type == AV_PICTURE_TYPE_I) { + if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) { do { check_for_slice(h); decode_mb_i(h, 0); } while (ff_cavs_next_mb(h)); - } else if (h->pic_type == AV_PICTURE_TYPE_P) { + } else if (h->cur.f->pict_type == AV_PICTURE_TYPE_P) { do { if (check_for_slice(h)) skip_count = -1; @@ -1055,7 +1055,7 @@ static int decode_pic(AVSContext *h) } } while (ff_cavs_next_mb(h)); } - if (h->pic_type != AV_PICTURE_TYPE_B) { + if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { if (h->DPB[1].f->data[0]) h->avctx->release_buffer(h->avctx, h->DPB[1].f); FFSWAP(AVSFrame, h->cur, h->DPB[1]); @@ -1165,7 +1165,7 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (decode_pic(h)) break; *got_frame = 1; - if (h->pic_type != AV_PICTURE_TYPE_B) { + if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { if (h->DPB[1].f->data[0]) { *picture = *h->DPB[1].f; } else { -- cgit v1.2.3 From 5e6ee38bd3cef0dd05f1dd7977c71f3479eb6d01 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 28 Dec 2012 06:20:01 +0100 Subject: FATE: add cavs test --- tests/fate/video.mak | 3 + tests/ref/fate/cavs | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 tests/ref/fate/cavs diff --git a/tests/fate/video.mak b/tests/fate/video.mak index 56060eca5b..51315dfaac 100644 --- a/tests/fate/video.mak +++ b/tests/fate/video.mak @@ -49,6 +49,9 @@ fate-bink-video: $(FATE_BINK_VIDEO) FATE_SAMPLES_AVCONV-$(call DEMDEC, BMV, BMV_VIDEO) += fate-bmv-video fate-bmv-video: CMD = framecrc -i $(SAMPLES)/bmv/SURFING-partial.BMV -pix_fmt rgb24 -an +FATE_SAMPLES_AVCONV-$(call DEMDEC, MPEGPS, CAVS) += fate-cavs +fate-cavs: CMD = framecrc -i $(SAMPLES)/cavs/cavs.mpg -an + FATE_SAMPLES_AVCONV-$(call DEMDEC, CDG, CDGRAPHICS) += fate-cdgraphics fate-cdgraphics: CMD = framecrc -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fmt rgb24 -t 1 diff --git a/tests/ref/fate/cavs b/tests/ref/fate/cavs new file mode 100644 index 0000000000..c96468a27b --- /dev/null +++ b/tests/ref/fate/cavs @@ -0,0 +1,171 @@ +#tb 0: 1/90000 +0, 0, 0, 0, 622080, 0x76183b91 +0, 3624, 3624, 0, 622080, 0x2ca5e808 +0, 7248, 7248, 0, 622080, 0xc503eda4 +0, 10872, 10872, 0, 622080, 0xa0dbf06c +0, 14496, 14496, 0, 622080, 0xf4363cfa +0, 18120, 18120, 0, 622080, 0xaa7dd9b8 +0, 21744, 21744, 0, 622080, 0x3ab6223b +0, 25368, 25368, 0, 622080, 0xe402644b +0, 28992, 28992, 0, 622080, 0xd0da3ade +0, 32616, 32616, 0, 622080, 0x0aff6151 +0, 36240, 36240, 0, 622080, 0x02aea3d5 +0, 39864, 39864, 0, 622080, 0x5d8eeccd +0, 43488, 43488, 0, 622080, 0x54384735 +0, 47112, 47112, 0, 622080, 0x890d71c2 +0, 50736, 50736, 0, 622080, 0xc60ae25b +0, 54360, 54360, 0, 622080, 0xe589e774 +0, 57984, 57984, 0, 622080, 0x03471e74 +0, 61608, 61608, 0, 622080, 0x4e22302c +0, 65232, 65232, 0, 622080, 0x00333583 +0, 68856, 68856, 0, 622080, 0xd6eae7d9 +0, 72480, 72480, 0, 622080, 0x72fe94f7 +0, 76104, 76104, 0, 622080, 0x3ebbad1e +0, 79728, 79728, 0, 622080, 0x2fb1de4b +0, 83352, 83352, 0, 622080, 0x3bfea6d2 +0, 86976, 86976, 0, 622080, 0x0fb551b2 +0, 90600, 90600, 0, 622080, 0xb203284f +0, 94224, 94224, 0, 622080, 0xb3baac30 +0, 97200, 97200, 0, 622080, 0x15f2c1c7 +0, 100824, 100824, 0, 622080, 0xb2b530ce +0, 104448, 104448, 0, 622080, 0xbbaaf241 +0, 108072, 108072, 0, 622080, 0x01bc9dfc +0, 111696, 111696, 0, 622080, 0x8a449a42 +0, 115320, 115320, 0, 622080, 0xdc63d73f +0, 118944, 118944, 0, 622080, 0xf06bc231 +0, 122568, 122568, 0, 622080, 0x19e04295 +0, 126192, 126192, 0, 622080, 0x1e7d1acd +0, 129816, 129816, 0, 622080, 0x43878b48 +0, 133440, 133440, 0, 622080, 0xcd94b702 +0, 137064, 137064, 0, 622080, 0xd2706cf1 +0, 140688, 140688, 0, 622080, 0x47d636f3 +0, 144312, 144312, 0, 622080, 0x4a516acc +0, 147936, 147936, 0, 622080, 0x52b7d89a +0, 151560, 151560, 0, 622080, 0xc9ba03be +0, 155184, 155184, 0, 622080, 0x6d17785e +0, 158808, 158808, 0, 622080, 0x8264871b +0, 162432, 162432, 0, 622080, 0xd59c84c0 +0, 166056, 166056, 0, 622080, 0x2b86d6cd +0, 169680, 169680, 0, 622080, 0x9c5a5f51 +0, 173304, 173304, 0, 622080, 0x221f79ca +0, 176928, 176928, 0, 622080, 0x98edb3ec +0, 180552, 180552, 0, 622080, 0x9a31262c +0, 184176, 184176, 0, 622080, 0x18f48378 +0, 187800, 187800, 0, 622080, 0x957c3d9c +0, 191424, 191424, 0, 622080, 0x9cc6866e +0, 195048, 195048, 0, 622080, 0x45613726 +0, 198672, 198672, 0, 622080, 0x7a6c5e65 +0, 202296, 202296, 0, 622080, 0x976d7a11 +0, 205200, 205200, 0, 622080, 0x192aea08 +0, 208824, 208824, 0, 622080, 0x8d4fc823 +0, 212448, 212448, 0, 622080, 0x1f9c55d7 +0, 216072, 216072, 0, 622080, 0xd4336d41 +0, 219696, 219696, 0, 622080, 0x7aa650cd +0, 223320, 223320, 0, 622080, 0x8efaaeb1 +0, 226944, 226944, 0, 622080, 0x3d8c3053 +0, 230568, 230568, 0, 622080, 0x1e2b64b0 +0, 234192, 234192, 0, 622080, 0x0436b1a7 +0, 237816, 237816, 0, 622080, 0xc5120072 +0, 241440, 241440, 0, 622080, 0x0203b245 +0, 245064, 245064, 0, 622080, 0x9815582b +0, 248688, 248688, 0, 622080, 0x3c60c359 +0, 252312, 252312, 0, 622080, 0x1a26b948 +0, 255936, 255936, 0, 622080, 0x56079812 +0, 259560, 259560, 0, 622080, 0x7b192a55 +0, 263184, 263184, 0, 622080, 0x335632ab +0, 266808, 266808, 0, 622080, 0xd0c12eb8 +0, 270432, 270432, 0, 622080, 0x93bf46cb +0, 274056, 274056, 0, 622080, 0xce67ce24 +0, 277680, 277680, 0, 622080, 0xff95bb26 +0, 281304, 281304, 0, 622080, 0x5e750705 +0, 284928, 284928, 0, 622080, 0x45a35725 +0, 288552, 288552, 0, 622080, 0xd8e93c39 +0, 292176, 292176, 0, 622080, 0xa9f8db50 +0, 295800, 295800, 0, 622080, 0xf90a862e +0, 299424, 299424, 0, 622080, 0x5e5a4216 +0, 303048, 303048, 0, 622080, 0xaaf45ed6 +0, 306672, 306672, 0, 622080, 0x1933cda5 +0, 310296, 310296, 0, 622080, 0x7ff68d91 +0, 313200, 313200, 0, 622080, 0x10038fe9 +0, 316824, 316824, 0, 622080, 0x9b3425a6 +0, 320448, 320448, 0, 622080, 0x8d2a141d +0, 324072, 324072, 0, 622080, 0x698a333e +0, 327696, 327696, 0, 622080, 0x334685d1 +0, 331320, 331320, 0, 622080, 0x40317d40 +0, 334944, 334944, 0, 622080, 0xd3c6f519 +0, 338568, 338568, 0, 622080, 0xfc2210c2 +0, 342192, 342192, 0, 622080, 0x3761df34 +0, 345816, 345816, 0, 622080, 0xef25462a +0, 349440, 349440, 0, 622080, 0x0fd38121 +0, 353064, 353064, 0, 622080, 0x184856a6 +0, 356688, 356688, 0, 622080, 0xc57c9f12 +0, 360312, 360312, 0, 622080, 0x39874291 +0, 363936, 363936, 0, 622080, 0x7c13cec4 +0, 367560, 367560, 0, 622080, 0xc4192a76 +0, 371184, 371184, 0, 622080, 0x2af404e3 +0, 374808, 374808, 0, 622080, 0x1ee18f41 +0, 378432, 378432, 0, 622080, 0xfb4d9ee5 +0, 382056, 382056, 0, 622080, 0x50aae4ff +0, 385680, 385680, 0, 622080, 0x030f91fe +0, 389304, 389304, 0, 622080, 0x3a3ee08c +0, 392928, 392928, 0, 622080, 0x50121423 +0, 396552, 396552, 0, 622080, 0xda39e2d6 +0, 400176, 400176, 0, 622080, 0x9e13ccd6 +0, 403800, 403800, 0, 622080, 0xb72a22a7 +0, 407424, 407424, 0, 622080, 0xb76904d5 +0, 411048, 411048, 0, 622080, 0xcffa04a8 +0, 414672, 414672, 0, 622080, 0x2984bf3f +0, 418296, 418296, 0, 622080, 0x274b5778 +0, 421200, 421200, 0, 622080, 0xf059413a +0, 424824, 424824, 0, 622080, 0x969fae57 +0, 428448, 428448, 0, 622080, 0x75c29097 +0, 432072, 432072, 0, 622080, 0x2bf3b07d +0, 435696, 435696, 0, 622080, 0x9f43271d +0, 439320, 439320, 0, 622080, 0x67bf23f3 +0, 442944, 442944, 0, 622080, 0xa8edcf33 +0, 446568, 446568, 0, 622080, 0x17a0789e +0, 450192, 450192, 0, 622080, 0x14b67cc7 +0, 453816, 453816, 0, 622080, 0x779215cd +0, 457440, 457440, 0, 622080, 0x8b460a21 +0, 461064, 461064, 0, 622080, 0x0502ad7d +0, 464688, 464688, 0, 622080, 0x6860678f +0, 468312, 468312, 0, 622080, 0xe180469e +0, 471936, 471936, 0, 622080, 0x9a992835 +0, 475560, 475560, 0, 622080, 0x2efafa33 +0, 479184, 479184, 0, 622080, 0xe24e59b2 +0, 482808, 482808, 0, 622080, 0xfb774d53 +0, 486432, 486432, 0, 622080, 0x3de4ea81 +0, 490056, 490056, 0, 622080, 0xaf9aa1d6 +0, 493680, 493680, 0, 622080, 0xa0e3722f +0, 497304, 497304, 0, 622080, 0x81684492 +0, 500928, 500928, 0, 622080, 0xa4e971fb +0, 504552, 504552, 0, 622080, 0x4a1903c8 +0, 508176, 508176, 0, 622080, 0x26304e4a +0, 511800, 511800, 0, 622080, 0x867983a4 +0, 515424, 515424, 0, 622080, 0x2e7e4d13 +0, 519048, 519048, 0, 622080, 0x736f4682 +0, 522672, 522672, 0, 622080, 0x426a95fa +0, 526296, 526296, 0, 622080, 0x2bc8850c +0, 529200, 529200, 0, 622080, 0x047e77ab +0, 532824, 532824, 0, 622080, 0x414ab77f +0, 536448, 536448, 0, 622080, 0x42681090 +0, 540072, 540072, 0, 622080, 0x80744ccb +0, 543696, 543696, 0, 622080, 0x50e2ecc0 +0, 547320, 547320, 0, 622080, 0x5c9fe70e +0, 550944, 550944, 0, 622080, 0x016461ee +0, 554568, 554568, 0, 622080, 0xd42f019a +0, 558192, 558192, 0, 622080, 0x8171bf41 +0, 561816, 561816, 0, 622080, 0xf4d8ef7e +0, 565440, 565440, 0, 622080, 0xf2d513c8 +0, 569064, 569064, 0, 622080, 0xb5b07704 +0, 572688, 572688, 0, 622080, 0x2168a07a +0, 576312, 576312, 0, 622080, 0x840418f9 +0, 579936, 579936, 0, 622080, 0xd36f1b7c +0, 583560, 583560, 0, 622080, 0x52532604 +0, 587184, 587184, 0, 622080, 0x0856d6eb +0, 590808, 590808, 0, 622080, 0x21748734 +0, 594432, 594432, 0, 622080, 0xbd315c05 +0, 598056, 598056, 0, 622080, 0x1cea8103 +0, 601680, 601680, 0, 622080, 0x71f6e3cb +0, 605304, 605304, 0, 622080, 0xb12d7aa7 +0, 608928, 608928, 0, 622080, 0x549b2acb -- cgit v1.2.3