# HG changeset patch # User conrad # Date 1266012095 0 # Node ID 449c12b6c3a0e7f7a9cada0a1481607940473892 # Parent 926f79d28a871804d41a623801a6fb292e4f49e6 Implement CODEC_CAP_DRAW_HORIZ_BAND for VP3 decoder diff -r 926f79d28a87 -r 449c12b6c3a0 vp3.c --- a/vp3.c Fri Feb 12 22:01:32 2010 +0000 +++ b/vp3.c Fri Feb 12 22:01:35 2010 +0000 @@ -135,6 +135,7 @@ int keyframe; DSPContext dsp; int flipped_image; + int last_slice_end; int qps[3]; int nqps; @@ -1450,6 +1451,37 @@ } } +/** + * called when all pixels up to row y are complete + */ +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= y - s->last_slice_end; + y -= h; + + if (!s->flipped_image) { + if (y == 0) + h -= s->height - s->avctx->height; // account for non-mod16 + y = s->height - y - h; + } + + 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); + s->last_slice_end= y + h; +} + /* * Perform the final rendering for a particular slice of data. * The slice number ranges from 0..(macroblock_height - 1). @@ -1624,7 +1656,9 @@ * dispatch (slice - 1); */ - emms_c(); + // now that we've filtered the last rows, they're safe to display + if (slice) + vp3_draw_horiz_band(s, 16*slice); } /* @@ -2008,6 +2042,7 @@ return -1; } + s->last_slice_end = 0; for (i = 0; i < s->macroblock_height; i++) render_slice(s, i); @@ -2016,6 +2051,7 @@ int row = (s->height >> (3+!!i)) - 1; apply_loop_filter(s, i, row, row+1); } + vp3_draw_horiz_band(s, s->height); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; @@ -2367,7 +2403,7 @@ 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 +2418,7 @@ 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"), };