summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-19 14:15:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-19 14:15:47 +0200
commitc5fd9d3c35cb743226770e1077e6b082f44bd889 (patch)
treee27eecd0a854a9e8a2374410b343f756835a468e /libavcodec
parent81ff0c24ef050c1877639ecc3ba6c485fde0a74e (diff)
parent61cc99748c1107a2f07491ce768156cc74b95e29 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: fate: Add proper dependencies in qt.mak fate: Add proper dependencies in lossless-video.mak indeo3: do not try to output more lines than we can fit bmv: get a new frame on every decode_frame(), so we can use direct rendering Conflicts: libavcodec/bmv.c tests/fate/lossless-video.mak tests/fate/qt.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/bmv.c17
-rw-r--r--libavcodec/indeo3.c20
2 files changed, 25 insertions, 12 deletions
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"),
};