diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-23 12:24:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-23 12:26:08 +0100 |
commit | 8b63eeb6b1c2f9e7d762f32dbd42dae124591314 (patch) | |
tree | 22c4f47fceef730a0f193cd168514ea65baeee66 | |
parent | 9bb6504e3bff2e00610f52cc41938aa8c2a3ad4c (diff) | |
parent | 3f15b301fa61547f59f1452b14edf14e5673fdd2 (diff) | |
download | ffmpeg-8b63eeb6b1c2f9e7d762f32dbd42dae124591314.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
fate: add test for cropping h264 to container dimensions
FATE: add a tscc2 test.
tscc2: allocate AVFrame properly.
Conflicts:
libavcodec/tscc2.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/tscc2.c | 39 | ||||
-rw-r--r-- | tests/fate/h264.mak | 2 | ||||
-rw-r--r-- | tests/fate/screen.mak | 3 | ||||
-rw-r--r-- | tests/ref/fate/h264-crop-to-container | 2 | ||||
-rw-r--r-- | tests/ref/fate/tscc2 | 33 |
5 files changed, 63 insertions, 16 deletions
diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c index f275ff9d8d..291693af3d 100644 --- a/libavcodec/tscc2.c +++ b/libavcodec/tscc2.c @@ -33,7 +33,7 @@ typedef struct TSCC2Context { AVCodecContext *avctx; - AVFrame pic; + AVFrame *pic; int mb_width, mb_height; uint8_t *slice_quants; int quant[2]; @@ -200,9 +200,9 @@ static int tscc2_decode_slice(TSCC2Context *c, int mb_y, if (q == 0 || q == 3) // skip block continue; for (i = 0; i < 3; i++) { - off = mb_x * 16 + mb_y * 8 * c->pic.linesize[i]; + off = mb_x * 16 + mb_y * 8 * c->pic->linesize[i]; ret = tscc2_decode_mb(c, c->q[q - 1], c->quant[q - 1] - 2, - c->pic.data[i] + off, c->pic.linesize[i], i); + c->pic->data[i] + off, c->pic->linesize[i], i); if (ret) return ret; } @@ -230,12 +230,13 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) + if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { return ret; + } if (frame_type == 0) { *got_frame = 1; - if ((ret = av_frame_ref(data, &c->pic)) < 0) + if ((ret = av_frame_ref(data, c->pic)) < 0) return ret; return buf_size; @@ -320,13 +321,24 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data, } *got_frame = 1; - if ((ret = av_frame_ref(data, &c->pic)) < 0) + if ((ret = av_frame_ref(data, c->pic)) < 0) return ret; /* always report that the buffer was completely consumed */ return buf_size; } +static av_cold int tscc2_decode_end(AVCodecContext *avctx) +{ + TSCC2Context * const c = avctx->priv_data; + + av_frame_free(&c->pic); + av_freep(&c->slice_quants); + free_vlcs(c); + + return 0; +} + static av_cold int tscc2_decode_init(AVCodecContext *avctx) { TSCC2Context * const c = avctx->priv_data; @@ -350,16 +362,11 @@ static av_cold int tscc2_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } - return 0; -} - -static av_cold int tscc2_decode_end(AVCodecContext *avctx) -{ - TSCC2Context * const c = avctx->priv_data; - - av_frame_unref(&c->pic); - av_freep(&c->slice_quants); - free_vlcs(c); + c->pic = av_frame_alloc(); + if (!c->pic) { + tscc2_decode_end(avctx); + return AVERROR(ENOMEM); + } return 0; } diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index 31ee5bf680..3263967ab4 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -193,6 +193,7 @@ FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \ fate-h264-lossless \ FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264) +FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-crop-to-container FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-interlace-crop FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF) += fate-h264-bsf-mp4toannexb @@ -384,6 +385,7 @@ fate-h264-conformance-sva_nl1_b: CMD = framecrc -vsync drop -i fate-h264-conformance-sva_nl2_e: CMD = framecrc -vsync drop -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264 fate-h264-bsf-mp4toannexb: CMD = md5 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb -f h264 +fate-h264-crop-to-container: CMD = framemd5 -i $(SAMPLES)/h264/crop-to-container-dims-canon.mov fate-h264-extreme-plane-pred: CMD = framemd5 -i $(SAMPLES)/h264/extreme-plane-pred.h264 fate-h264-interlace-crop: CMD = framecrc -i $(SAMPLES)/h264/interlaced_crop.mp4 -vframes 3 fate-h264-lossless: CMD = framecrc -i $(SAMPLES)/h264/lossless.h264 diff --git a/tests/fate/screen.mak b/tests/fate/screen.mak index b55e02b42b..e1b854ef55 100644 --- a/tests/fate/screen.mak +++ b/tests/fate/screen.mak @@ -35,6 +35,9 @@ fate-tscc-32bit: CMD = framecrc -i $(SAMPLES)/tscc/2004-12-17-uebung9-partial.av FATE_SCREEN-$(call DEMDEC, AVI, TSCC) += $(FATE_TSCC) fate-tscc: $(FATE_TSCC) +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TSCC2) += fate-tscc2 +fate-tscc2: CMD = framecrc -i $(SAMPLES)/tscc/tsc2_16bpp.avi + FATE_VMNC += fate-vmnc-16bit fate-vmnc-16bit: CMD = framecrc -i $(SAMPLES)/VMnc/test.avi -pix_fmt rgb24 diff --git a/tests/ref/fate/h264-crop-to-container b/tests/ref/fate/h264-crop-to-container new file mode 100644 index 0000000000..0f435ea45f --- /dev/null +++ b/tests/ref/fate/h264-crop-to-container @@ -0,0 +1,2 @@ +#tb 0: 1001/30000 +0, 0, 0, 1, 3110400, 43a312e1eebc7dca1bd23456302a44e3 diff --git a/tests/ref/fate/tscc2 b/tests/ref/fate/tscc2 new file mode 100644 index 0000000000..ad71b8254d --- /dev/null +++ b/tests/ref/fate/tscc2 @@ -0,0 +1,33 @@ +#tb 0: 1/24 +0, 0, 0, 1, 230400, 0x7a2103c0 +0, 1, 1, 1, 230400, 0xd381c279 +0, 2, 2, 1, 230400, 0xd381c279 +0, 3, 3, 1, 230400, 0x110aec27 +0, 4, 4, 1, 230400, 0x4be67ee7 +0, 5, 5, 1, 230400, 0xd87fe4b4 +0, 6, 6, 1, 230400, 0xd87fe4b4 +0, 7, 7, 1, 230400, 0x9bc6a398 +0, 8, 8, 1, 230400, 0xd67d92db +0, 9, 9, 1, 230400, 0x3df6559e +0, 10, 10, 1, 230400, 0x3df6559e +0, 11, 11, 1, 230400, 0x2136ff25 +0, 12, 12, 1, 230400, 0x94573fe6 +0, 13, 13, 1, 230400, 0xbf67d3f5 +0, 14, 14, 1, 230400, 0xbf67d3f5 +0, 15, 15, 1, 230400, 0x2592b5cf +0, 16, 16, 1, 230400, 0x5b23cd93 +0, 17, 17, 1, 230400, 0x9b76d079 +0, 18, 18, 1, 230400, 0x9b76d079 +0, 19, 19, 1, 230400, 0x771a017e +0, 20, 20, 1, 230400, 0xacfee1d0 +0, 21, 21, 1, 230400, 0x6b9ff4eb +0, 22, 22, 1, 230400, 0x6b9ff4eb +0, 23, 23, 1, 230400, 0xbaf643e1 +0, 24, 24, 1, 230400, 0x052efe59 +0, 25, 25, 1, 230400, 0xd751f901 +0, 26, 26, 1, 230400, 0xd751f901 +0, 27, 27, 1, 230400, 0x6f94e11f +0, 28, 28, 1, 230400, 0x17eeabb9 +0, 29, 29, 1, 230400, 0x3733a035 +0, 30, 30, 1, 230400, 0x3733a035 +0, 31, 31, 1, 230400, 0xb0829f45 |