diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 665af929bb..c9066dfa5c 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -198,7 +198,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; @@ -239,6 +239,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; @@ -275,12 +284,6 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - 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; diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 4cee28f9de..404d24a84f 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -1010,14 +1010,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); @@ -1101,9 +1104,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; @@ -1132,5 +1141,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"), }; diff --git a/tests/fate/lossless-video.mak b/tests/fate/lossless-video.mak index cbf7f5292a..b648b082d1 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_LOSSLESS_VIDEO += $(FATE_CLLC) +FATE_LOSSLESS_VIDEO-$(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_LOSSLESS_VIDEO-$(call DEMDEC, AVI, LAGARITH) += $(FATE_LAGARITH) fate-lagarith: $(FATE_LAGARITH) FATE_LOCO += fate-loco-rgb @@ -28,22 +28,22 @@ 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_LOSSLESS_VIDEO += $(FATE_LOCO) +FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, LOCO) += $(FATE_LOCO) fate-loco: $(FATE_LOCO) -FATE_LOSSLESS_VIDEO += fate-msrle-8bit +FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, MSRLE) += fate-msrle-8bit fate-msrle-8bit: CMD = framecrc -i $(SAMPLES)/msrle/Search-RLE.avi -pix_fmt rgb24 -FATE_LOSSLESS_VIDEO += fate-mszh +FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, MSZH) += fate-mszh fate-mszh: CMD = framecrc -i $(SAMPLES)/lcl/mszh-1frame.avi -FATE_LOSSLESS_VIDEO += fate-vble +FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, VBLE) += fate-vble fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi -FATE_LOSSLESS_VIDEO-$(CONFIG_ZLIB) += fate-zlib +FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, ZLIB) += fate-zlib fate-zlib: CMD = framecrc -i $(SAMPLES)/lcl/zlib-1frame.avi -FATE_LOSSLESS_VIDEO-$(CONFIG_ZLIB) += fate-zerocodec +FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, ZEROCODEC) += fate-zerocodec fate-zerocodec: CMD = framecrc -i $(SAMPLES)/zerocodec/sample-zeco.avi FATE_LOSSLESS_VIDEO += $(FATE_LOSSLESS_VIDEO-yes) diff --git a/tests/fate/qt.mak b/tests/fate/qt.mak index 3068ac63ec..03b2fcec71 100644 --- a/tests/fate/qt.mak +++ b/tests/fate/qt.mak @@ -1,52 +1,52 @@ -FATE_QT += fate-8bps +FATE_QT-$(call DEMDEC, MOV, EIGHTBPS) += fate-8bps fate-8bps: CMD = framecrc -i $(SAMPLES)/8bps/full9iron-partial.mov -pix_fmt rgb24 -FATE_QT += fate-qdm2 +FATE_QT-$(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_QT += fate-qt-alaw-mono +FATE_QT-$(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_QT += fate-qt-alaw-stereo +FATE_QT-$(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_QT += fate-qt-ima4-mono +FATE_QT-$(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_QT += fate-qt-ima4-stereo +FATE_QT-$(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_QT += fate-qt-mac3-mono +FATE_QT-$(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_QT += fate-qt-mac3-stereo +FATE_QT-$(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_QT += fate-qt-mac6-mono +FATE_QT-$(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_QT += fate-qt-mac6-stereo +FATE_QT-$(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_QT += fate-qt-ulaw-mono +FATE_QT-$(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_QT += fate-qt-ulaw-stereo +FATE_QT-$(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_QT += fate-quickdraw +FATE_QT-$(call DEMDEC, MOV, QDRAW) += fate-quickdraw fate-quickdraw: CMD = framecrc -i $(SAMPLES)/quickdraw/Airplane.mov -pix_fmt rgb24 -FATE_QT += fate-rpza +FATE_QT-$(call DEMDEC, MOV, RPZA) += fate-rpza fate-rpza: CMD = framecrc -i $(SAMPLES)/rpza/rpza2.mov -t 2 -pix_fmt rgb24 -FATE_QT += fate-svq1 +FATE_QT-$(call DEMDEC, MOV, SVQ1) += fate-svq1 fate-svq1: CMD = framecrc -i $(SAMPLES)/svq1/marymary-shackles.mov -an -t 10 -FATE_QT-$(CONFIG_ZLIB) += fate-svq3 +FATE_QT-$(call ALLYES, MOV_DEMUXER SVQ3_DECODER ZLIB) += fate-svq3 fate-svq3: CMD = framecrc -i $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov -t 6 -an FATE_QT += $(FATE_QT-yes)