1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '5e6ee38bd3cef0dd05f1dd7977c71f3479eb6d01'

* commit '5e6ee38bd3cef0dd05f1dd7977c71f3479eb6d01':
  FATE: add cavs test
  cavsdec: export picture type in the output frame

Conflicts:
	tests/fate/video.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-12-31 13:40:15 +01:00
commit 98275283d5
4 changed files with 190 additions and 16 deletions

View File

@ -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;

View File

@ -634,7 +634,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;
}
@ -673,7 +673,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 > 63U) {
av_log(h->avctx, AV_LOG_ERROR, "illegal intra cbp\n");
@ -901,7 +901,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,
@ -946,17 +946,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,
@ -988,7 +988,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;
@ -996,7 +996,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;
@ -1015,12 +1015,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);
@ -1032,12 +1032,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;
@ -1070,7 +1070,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]);
@ -1186,7 +1186,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 {

View File

@ -51,6 +51,9 @@ FATE_VIDEO-$(call DEMDEC, BINK, BINK) += $(FATE_BINK_VIDEO)
FATE_VIDEO-$(call DEMDEC, BMV, BMV_VIDEO) += fate-bmv-video
fate-bmv-video: CMD = framecrc -i $(SAMPLES)/bmv/SURFING-partial.BMV -pix_fmt rgb24 -an
FATE_VIDEO-$(call DEMDEC, MPEGPS, CAVS) += fate-cavs
fate-cavs: CMD = framecrc -i $(SAMPLES)/cavs/cavs.mpg -an
FATE_VIDEO-$(call DEMDEC, CDG, CDGRAPHICS) += fate-cdgraphics
fate-cdgraphics: CMD = framecrc -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fmt rgb24 -t 1

172
tests/ref/fate/cavs Normal file
View File

@ -0,0 +1,172 @@
#tb 0: 1/25
0, 0, 0, 1, 622080, 0x76183b91
0, 1, 1, 1, 622080, 0x2ca5e808
0, 2, 2, 1, 622080, 0xc503eda4
0, 3, 3, 1, 622080, 0xa0dbf06c
0, 4, 4, 1, 622080, 0xf4363cfa
0, 5, 5, 1, 622080, 0xaa7dd9b8
0, 6, 6, 1, 622080, 0x3ab6223b
0, 7, 7, 1, 622080, 0xe402644b
0, 8, 8, 1, 622080, 0xd0da3ade
0, 9, 9, 1, 622080, 0x0aff6151
0, 10, 10, 1, 622080, 0x02aea3d5
0, 11, 11, 1, 622080, 0x5d8eeccd
0, 12, 12, 1, 622080, 0x54384735
0, 13, 13, 1, 622080, 0x890d71c2
0, 14, 14, 1, 622080, 0xc60ae25b
0, 15, 15, 1, 622080, 0xe589e774
0, 16, 16, 1, 622080, 0x03471e74
0, 17, 17, 1, 622080, 0x4e22302c
0, 18, 18, 1, 622080, 0x00333583
0, 19, 19, 1, 622080, 0xd6eae7d9
0, 20, 20, 1, 622080, 0x72fe94f7
0, 21, 21, 1, 622080, 0x3ebbad1e
0, 22, 22, 1, 622080, 0x2fb1de4b
0, 23, 23, 1, 622080, 0x3bfea6d2
0, 24, 24, 1, 622080, 0x0fb551b2
0, 25, 25, 1, 622080, 0xb203284f
0, 26, 26, 1, 622080, 0xb3baac30
0, 27, 27, 1, 622080, 0x15f2c1c7
0, 28, 28, 1, 622080, 0xb2b530ce
0, 29, 29, 1, 622080, 0xbbaaf241
0, 30, 30, 1, 622080, 0x01bc9dfc
0, 31, 31, 1, 622080, 0x8a449a42
0, 32, 32, 1, 622080, 0xdc63d73f
0, 33, 33, 1, 622080, 0xf06bc231
0, 34, 34, 1, 622080, 0x19e04295
0, 35, 35, 1, 622080, 0x1e7d1acd
0, 36, 36, 1, 622080, 0x43878b48
0, 37, 37, 1, 622080, 0xcd94b702
0, 38, 38, 1, 622080, 0xd2706cf1
0, 39, 39, 1, 622080, 0x47d636f3
0, 40, 40, 1, 622080, 0x4a516acc
0, 41, 41, 1, 622080, 0x52b7d89a
0, 42, 42, 1, 622080, 0xc9ba03be
0, 43, 43, 1, 622080, 0x6d17785e
0, 44, 44, 1, 622080, 0x8264871b
0, 45, 45, 1, 622080, 0xd59c84c0
0, 46, 46, 1, 622080, 0x2b86d6cd
0, 47, 47, 1, 622080, 0x9c5a5f51
0, 48, 48, 1, 622080, 0x221f79ca
0, 49, 49, 1, 622080, 0x98edb3ec
0, 50, 50, 1, 622080, 0x9a31262c
0, 51, 51, 1, 622080, 0x18f48378
0, 52, 52, 1, 622080, 0x957c3d9c
0, 53, 53, 1, 622080, 0x9cc6866e
0, 54, 54, 1, 622080, 0x45613726
0, 55, 55, 1, 622080, 0x7a6c5e65
0, 56, 56, 1, 622080, 0x976d7a11
0, 57, 57, 1, 622080, 0x192aea08
0, 58, 58, 1, 622080, 0x8d4fc823
0, 59, 59, 1, 622080, 0x1f9c55d7
0, 60, 60, 1, 622080, 0xd4336d41
0, 61, 61, 1, 622080, 0x7aa650cd
0, 62, 62, 1, 622080, 0x8efaaeb1
0, 63, 63, 1, 622080, 0x3d8c3053
0, 64, 64, 1, 622080, 0x1e2b64b0
0, 65, 65, 1, 622080, 0x0436b1a7
0, 66, 66, 1, 622080, 0xc5120072
0, 67, 67, 1, 622080, 0x0203b245
0, 68, 68, 1, 622080, 0x9815582b
0, 69, 69, 1, 622080, 0x3c60c359
0, 70, 70, 1, 622080, 0x1a26b948
0, 71, 71, 1, 622080, 0x56079812
0, 72, 72, 1, 622080, 0x7b192a55
0, 73, 73, 1, 622080, 0x335632ab
0, 74, 74, 1, 622080, 0xd0c12eb8
0, 75, 75, 1, 622080, 0x93bf46cb
0, 76, 76, 1, 622080, 0xce67ce24
0, 77, 77, 1, 622080, 0xff95bb26
0, 78, 78, 1, 622080, 0x5e750705
0, 79, 79, 1, 622080, 0x45a35725
0, 80, 80, 1, 622080, 0xd8e93c39
0, 81, 81, 1, 622080, 0xa9f8db50
0, 82, 82, 1, 622080, 0xf90a862e
0, 83, 83, 1, 622080, 0x5e5a4216
0, 84, 84, 1, 622080, 0xaaf45ed6
0, 85, 85, 1, 622080, 0x1933cda5
0, 86, 86, 1, 622080, 0x7ff68d91
0, 87, 87, 1, 622080, 0x10038fe9
0, 88, 88, 1, 622080, 0x9b3425a6
0, 89, 89, 1, 622080, 0x8d2a141d
0, 90, 90, 1, 622080, 0x698a333e
0, 91, 91, 1, 622080, 0x334685d1
0, 92, 92, 1, 622080, 0x40317d40
0, 93, 93, 1, 622080, 0xd3c6f519
0, 94, 94, 1, 622080, 0xfc2210c2
0, 95, 95, 1, 622080, 0x3761df34
0, 96, 96, 1, 622080, 0xef25462a
0, 97, 97, 1, 622080, 0x0fd38121
0, 98, 98, 1, 622080, 0x184856a6
0, 99, 99, 1, 622080, 0xc57c9f12
0, 100, 100, 1, 622080, 0x39874291
0, 101, 101, 1, 622080, 0x7c13cec4
0, 102, 102, 1, 622080, 0xc4192a76
0, 103, 103, 1, 622080, 0x2af404e3
0, 104, 104, 1, 622080, 0x1ee18f41
0, 105, 105, 1, 622080, 0xfb4d9ee5
0, 106, 106, 1, 622080, 0x50aae4ff
0, 107, 107, 1, 622080, 0x030f91fe
0, 108, 108, 1, 622080, 0x3a3ee08c
0, 109, 109, 1, 622080, 0x50121423
0, 110, 110, 1, 622080, 0xda39e2d6
0, 111, 111, 1, 622080, 0x9e13ccd6
0, 112, 112, 1, 622080, 0xb72a22a7
0, 113, 113, 1, 622080, 0xb76904d5
0, 114, 114, 1, 622080, 0xcffa04a8
0, 115, 115, 1, 622080, 0x2984bf3f
0, 116, 116, 1, 622080, 0x274b5778
0, 117, 117, 1, 622080, 0xf059413a
0, 118, 118, 1, 622080, 0x969fae57
0, 119, 119, 1, 622080, 0x75c29097
0, 120, 120, 1, 622080, 0x2bf3b07d
0, 121, 121, 1, 622080, 0x9f43271d
0, 122, 122, 1, 622080, 0x67bf23f3
0, 123, 123, 1, 622080, 0xa8edcf33
0, 124, 124, 1, 622080, 0x17a0789e
0, 125, 125, 1, 622080, 0x14b67cc7
0, 126, 126, 1, 622080, 0x779215cd
0, 127, 127, 1, 622080, 0x8b460a21
0, 128, 128, 1, 622080, 0x0502ad7d
0, 129, 129, 1, 622080, 0x6860678f
0, 130, 130, 1, 622080, 0xe180469e
0, 131, 131, 1, 622080, 0x9a992835
0, 132, 132, 1, 622080, 0x2efafa33
0, 133, 133, 1, 622080, 0xe24e59b2
0, 134, 134, 1, 622080, 0xfb774d53
0, 135, 135, 1, 622080, 0x3de4ea81
0, 136, 136, 1, 622080, 0xaf9aa1d6
0, 137, 137, 1, 622080, 0xa0e3722f
0, 138, 138, 1, 622080, 0x81684492
0, 139, 139, 1, 622080, 0xa4e971fb
0, 140, 140, 1, 622080, 0x4a1903c8
0, 141, 141, 1, 622080, 0x26304e4a
0, 142, 142, 1, 622080, 0x867983a4
0, 143, 143, 1, 622080, 0x2e7e4d13
0, 144, 144, 1, 622080, 0x736f4682
0, 145, 145, 1, 622080, 0x426a95fa
0, 146, 146, 1, 622080, 0x2bc8850c
0, 147, 147, 1, 622080, 0x047e77ab
0, 148, 148, 1, 622080, 0x414ab77f
0, 149, 149, 1, 622080, 0x42681090
0, 150, 150, 1, 622080, 0x80744ccb
0, 151, 151, 1, 622080, 0x50e2ecc0
0, 152, 152, 1, 622080, 0x5c9fe70e
0, 153, 153, 1, 622080, 0x016461ee
0, 154, 154, 1, 622080, 0xd42f019a
0, 155, 155, 1, 622080, 0x8171bf41
0, 156, 156, 1, 622080, 0xf4d8ef7e
0, 157, 157, 1, 622080, 0xf2d513c8
0, 158, 158, 1, 622080, 0xb5b07704
0, 159, 159, 1, 622080, 0x2168a07a
0, 160, 160, 1, 622080, 0x840418f9
0, 161, 161, 1, 622080, 0xd36f1b7c
0, 162, 162, 1, 622080, 0x52532604
0, 163, 163, 1, 622080, 0x0856d6eb
0, 164, 164, 1, 622080, 0x21748734
0, 165, 165, 1, 622080, 0xbd315c05
0, 166, 166, 1, 622080, 0x1cea8103
0, 167, 167, 1, 622080, 0x71f6e3cb
0, 168, 168, 1, 622080, 0xb12d7aa7
0, 169, 169, 1, 622080, 0x54dd2acb
0, 170, 170, 1, 622080, 0xe8f93765