[FFmpeg-devel] [PATCH 3/3] Implement CODEC_CAP_DRAW_HORIZ_BAND for VP3 decoder
David Conrad
lessen42
Wed Feb 10 02:54:04 CET 2010
---
libavcodec/vp3.c | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index cd0c3c7..e35ab5f 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1450,6 +1450,32 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye
}
}
+static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y)
+{
+ int h, cy;
+ int offset[4];
+
+ if(s->avctx->draw_horiz_band==NULL)
+ return;
+
+ h = 16;
+
+ if (!s->flipped_image) {
+ if (y == 0)
+ h -= s->height - s->avctx->height; // account for non-mod16
+ y = s->height - y - 16;
+ }
+
+ cy = y >> 1;
+ offset[0] = s->current_frame.linesize[0]*y;
+ offset[1] = s->current_frame.linesize[1]*cy;
+ offset[2] = s->current_frame.linesize[2]*cy;
+ offset[3] = 0;
+
+ emms_c();
+ s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h);
+}
+
/*
* Perform the final rendering for a particular slice of data.
* The slice number ranges from 0..(macroblock_height - 1).
@@ -1624,7 +1650,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
* dispatch (slice - 1);
*/
- emms_c();
+ vp3_draw_horiz_band(s, 16*slice);
}
/*
@@ -2367,7 +2393,7 @@ AVCodec theora_decoder = {
NULL,
vp3_decode_end,
vp3_decode_frame,
- CODEC_CAP_DR1,
+ CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
NULL,
.long_name = NULL_IF_CONFIG_SMALL("Theora"),
};
@@ -2382,7 +2408,7 @@ AVCodec vp3_decoder = {
NULL,
vp3_decode_end,
vp3_decode_frame,
- CODEC_CAP_DR1,
+ CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
NULL,
.long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
};
--
1.6.6
More information about the ffmpeg-devel
mailing list