From 8774d5835806e02e875e833f6a0b48b26413c730 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 18 Oct 2012 11:08:01 +0200 Subject: [PATCH 1/4] bmv: get a new frame on every decode_frame(), so we can use direct rendering --- libavcodec/bmv.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 876c13f923..461111967d 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -196,7 +196,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac { BMVDecContext * const c = avctx->priv_data; int type, scr_off; - int i; + int i, ret; uint8_t *srcptr, *outptr; c->stream = pkt->data; @@ -237,6 +237,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac scr_off = 0; } + if (c->pic.data[0]) + avctx->release_buffer(avctx, &c->pic); + + c->pic.reference = 3; + if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; + } + if (decode_bmv_frame(c->stream, pkt->size - (c->stream - pkt->data), c->frame, scr_off)) { av_log(avctx, AV_LOG_ERROR, "Error decoding frame data\n"); return AVERROR_INVALIDDATA; @@ -268,12 +277,6 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; - c->pic.reference = 1; - if (avctx->get_buffer(avctx, &c->pic) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } - c->frame = c->frame_base + 640; return 0; @@ -365,6 +368,7 @@ AVCodec ff_bmv_video_decoder = { .init = decode_init, .close = decode_end, .decode = decode_frame, + .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV video"), }; From 169514c440a75e8967f4416d1ec2bd0402a68876 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 18 Oct 2012 11:45:42 +0200 Subject: [PATCH 2/4] indeo3: do not try to output more lines than we can fit Internally chroma planes have multiple of four height while allocated image planes might be smaller if CODEC_FLAG_EMU_EDGE is set. Thus we should not output more lines of chroma than frame can accept. Also the decoder can be safely switched to direct rendering now. --- libavcodec/indeo3.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index c99cee801c..fc0d2bc11b 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -978,14 +978,17 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx, * @param[in] buf_sel indicates which frame buffer the input data stored in * @param[out] dst pointer to the buffer receiving converted pixels * @param[in] dst_pitch pitch for moving to the next y line + * @param[in] dst_height output plane height */ -static void output_plane(const Plane *plane, int buf_sel, uint8_t *dst, int dst_pitch) +static void output_plane(const Plane *plane, int buf_sel, uint8_t *dst, + int dst_pitch, int dst_height) { int x,y; const uint8_t *src = plane->pixels[buf_sel]; uint32_t pitch = plane->pitch; - for (y = 0; y < plane->height; y++) { + dst_height = FFMIN(dst_height, plane->height); + for (y = 0; y < dst_height; y++) { /* convert four pixels at once using SWAR */ for (x = 0; x < plane->width >> 2; x++) { AV_WN32A(dst, (AV_RN32A(src) & 0x7F7F7F7F) << 1); @@ -1072,9 +1075,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, return res; } - output_plane(&ctx->planes[0], ctx->buf_sel, ctx->frame.data[0], ctx->frame.linesize[0]); - output_plane(&ctx->planes[1], ctx->buf_sel, ctx->frame.data[1], ctx->frame.linesize[1]); - output_plane(&ctx->planes[2], ctx->buf_sel, ctx->frame.data[2], ctx->frame.linesize[2]); + output_plane(&ctx->planes[0], ctx->buf_sel, + ctx->frame.data[0], ctx->frame.linesize[0], + avctx->height); + output_plane(&ctx->planes[1], ctx->buf_sel, + ctx->frame.data[1], ctx->frame.linesize[1], + (avctx->height + 3) >> 2); + output_plane(&ctx->planes[2], ctx->buf_sel, + ctx->frame.data[2], ctx->frame.linesize[2], + (avctx->height + 3) >> 2); *data_size = sizeof(AVFrame); *(AVFrame*)data = ctx->frame; @@ -1103,5 +1112,6 @@ AVCodec ff_indeo3_decoder = { .init = decode_init, .close = decode_close, .decode = decode_frame, + .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"), }; From 91485e744f8c5b9c5f07debeaa8af4e6217c0a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 19 Oct 2012 00:35:32 +0300 Subject: [PATCH 3/4] fate: Add proper dependencies in lossless-video.mak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output of make fate-list is identical to before. Signed-off-by: Martin Storsjö --- tests/fate/lossless-video.mak | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/fate/lossless-video.mak b/tests/fate/lossless-video.mak index 5055730b35..06b6dd5535 100644 --- a/tests/fate/lossless-video.mak +++ b/tests/fate/lossless-video.mak @@ -4,7 +4,7 @@ fate-cllc-rgb: CMD = framecrc -i $(SAMPLES)/cllc/sample-cllc-rgb.avi FATE_CLLC += fate-cllc-argb fate-cllc-argb: CMD = framecrc -i $(SAMPLES)/cllc/sample-cllc-argb.avi -FATE_SAMPLES_AVCONV += $(FATE_CLLC) +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, CLLC) += $(FATE_CLLC) fate-cllc: $(FATE_CLLC) FATE_LAGARITH += fate-lagarith-rgb24 @@ -19,7 +19,7 @@ fate-lagarith-yuy2: CMD = framecrc -i $(SAMPLES)/lagarith/lag-yuy2.avi FATE_LAGARITH += fate-lagarith-yv12 fate-lagarith-yv12: CMD = framecrc -i $(SAMPLES)/lagarith/lag-yv12.avi -FATE_SAMPLES_AVCONV += $(FATE_LAGARITH) +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, LAGARITH) += $(FATE_LAGARITH) fate-lagarith: $(FATE_LAGARITH) FATE_LOCO += fate-loco-rgb @@ -28,20 +28,20 @@ fate-loco-rgb: CMD = framecrc -i $(SAMPLES)/loco/pig-loco-rgb.avi FATE_LOCO += fate-loco-yuy2 fate-loco-yuy2: CMD = framecrc -i $(SAMPLES)/loco/pig-loco-0.avi -FATE_SAMPLES_AVCONV += $(FATE_LOCO) +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, LOCO) += $(FATE_LOCO) fate-loco: $(FATE_LOCO) -FATE_SAMPLES_AVCONV += fate-msrle-8bit +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, MSRLE) += fate-msrle-8bit fate-msrle-8bit: CMD = framecrc -i $(SAMPLES)/msrle/Search-RLE.avi -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += fate-mszh +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, MSZH) += fate-mszh fate-mszh: CMD = framecrc -i $(SAMPLES)/lcl/mszh-1frame.avi -FATE_SAMPLES_AVCONV += fate-vble +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VBLE) += fate-vble fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi -FATE_SAMPLES_AVCONV += fate-zlib +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, ZLIB) += fate-zlib fate-zlib: CMD = framecrc -i $(SAMPLES)/lcl/zlib-1frame.avi -FATE_SAMPLES_AVCONV += fate-zerocodec +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, ZEROCODEC) += fate-zerocodec fate-zerocodec: CMD = framecrc -i $(SAMPLES)/zerocodec/sample-zeco.avi From 61cc99748c1107a2f07491ce768156cc74b95e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 19 Oct 2012 01:49:15 +0300 Subject: [PATCH 4/4] fate: Add proper dependencies in qt.mak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output of make fate-list is identical to before. Signed-off-by: Martin Storsjö --- tests/fate/qt.mak | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/fate/qt.mak b/tests/fate/qt.mak index b2b9500666..79155f59fc 100644 --- a/tests/fate/qt.mak +++ b/tests/fate/qt.mak @@ -1,50 +1,50 @@ -FATE_SAMPLES_AVCONV += fate-8bps +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, EIGHTBPS) += fate-8bps fate-8bps: CMD = framecrc -i $(SAMPLES)/8bps/full9iron-partial.mov -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += fate-qdm2 +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QDM2) += fate-qdm2 fate-qdm2: CMD = pcm -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.mov fate-qdm2: CMP = oneoff fate-qdm2: REF = $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.pcm fate-qdm2: FUZZ = 2 -FATE_SAMPLES_AVCONV += fate-qt-alaw-mono +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_ALAW) += fate-qt-alaw-mono fate-qt-alaw-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-16-B-alaw.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-alaw-stereo +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_ALAW) += fate-qt-alaw-stereo fate-qt-alaw-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-alaw.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-ima4-mono +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ADPCM_IMA_QT) += fate-qt-ima4-mono fate-qt-ima4-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-16-B-ima4.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-ima4-stereo +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ADPCM_IMA_QT) += fate-qt-ima4-stereo fate-qt-ima4-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-ima4.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-mac3-mono +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE3) += fate-qt-mac3-mono fate-qt-mac3-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-8-MAC3.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-mac3-stereo +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE3) += fate-qt-mac3-stereo fate-qt-mac3-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-8-MAC3.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-mac6-mono +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE6) += fate-qt-mac6-mono fate-qt-mac6-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-8-MAC6.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-mac6-stereo +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE6) += fate-qt-mac6-stereo fate-qt-mac6-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-8-MAC6.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-ulaw-mono +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_MULAW) += fate-qt-ulaw-mono fate-qt-ulaw-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-16-B-ulaw.mov -f s16le -FATE_SAMPLES_AVCONV += fate-qt-ulaw-stereo +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_MULAW) += fate-qt-ulaw-stereo fate-qt-ulaw-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-ulaw.mov -f s16le -FATE_SAMPLES_AVCONV += fate-quickdraw +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QDRAW) += fate-quickdraw fate-quickdraw: CMD = framecrc -i $(SAMPLES)/quickdraw/Airplane.mov -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += fate-rpza +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, RPZA) += fate-rpza fate-rpza: CMD = framecrc -i $(SAMPLES)/rpza/rpza2.mov -t 2 -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += fate-svq1 +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, SVQ1) += fate-svq1 fate-svq1: CMD = framecrc -i $(SAMPLES)/svq1/marymary-shackles.mov -an -t 10 -FATE_SAMPLES_AVCONV += fate-svq3 +FATE_SAMPLES_AVCONV-$(call ALLYES, MOV_DEMUXER SVQ3_DECODER ZLIB) += fate-svq3 fate-svq3: CMD = framecrc -i $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov -t 6 -an