1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

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>
This commit is contained in:
Michael Niedermayer 2013-03-23 12:24:05 +01:00
commit 8b63eeb6b1
5 changed files with 63 additions and 16 deletions

View File

@ -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,17 +362,12 @@ static av_cold int tscc2_decode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM);
}
return 0;
c->pic = av_frame_alloc();
if (!c->pic) {
tscc2_decode_end(avctx);
return AVERROR(ENOMEM);
}
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);
return 0;
}

View File

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

View File

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

View File

@ -0,0 +1,2 @@
#tb 0: 1001/30000
0, 0, 0, 1, 3110400, 43a312e1eebc7dca1bd23456302a44e3

33
tests/ref/fate/tscc2 Normal file
View File

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