[FFmpeg-devel] [PATCH] Bitmap Brothers JV video decoder

Kostya kostya.shishkov
Wed Mar 9 11:48:39 CET 2011


On Wed, Mar 09, 2011 at 09:31:33PM +1100, Peter Ross wrote:
> ---
> On Tue, Mar 08, 2011 at 04:25:48PM +0100, Kostya wrote:
> > On Wed, Mar 09, 2011 at 02:10:30AM +1100, Peter Ross wrote:
> [...]
> > > + */
> > > +static void decode2x2(GetBitContext *gb, uint8_t *dst, int linesize)
> > > +{
> > > +    int i, j, v[2];
> > > +    switch(get_bits(gb, 2)) {
> >
> > let's hope Diego won't see this
> 
> Those whitespace nits are now fixed.

nope, it's all "switch(" in the code without whitespace but loops indentation
is fixed indeed
 
> > here too - why it's upside-down?
> 
> That's how JV codec encodes the video. Yes, it too struck me as
> wierd the first time I saw it. My guess is the author made a buggy
> encoder/decoder optimisation.

ok

> diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
> new file mode 100644
> index 0000000..e654cd2
> --- /dev/null
> +++ b/libavcodec/jvdec.c
[...]
> +    case 3:
> +        for (j = 0; j < 2; j++)
> +            for (i = 0; i < 2; i++)
> +                decode2x2(gb, dst + j*2*linesize + i*2, linesize);
[...]
> +    case 3:
> +        for (j = 0; j < 2; j++)
> +            for (i = 0; i < 2; i++)
> +                decode4x4(gb, dst + j*4*linesize + i*4, linesize);
[...]
> +            for (j = 0; j < avctx->height >> 3; j++)
> +                for (i = 0; i < avctx->width  >> 3; i++)
> +                    decode8x8(&gb, s->frame.data[0] + j*8*s->frame.linesize[0] + i*8,
> +                              s->frame.linesize[0], &s->dsp);

I think you can use different increment in those cases, at least in the last
one (i.e. for (i = 0; i < avctx->width; i += 8) )



More information about the ffmpeg-devel mailing list