[FFmpeg-devel] [PATCH 1/3] Bitmap Brothers JV video decoder
Kostya
kostya.shishkov
Tue Mar 8 16:25:48 CET 2011
On Wed, Mar 09, 2011 at 02:10:30AM +1100, Peter Ross wrote:
> ---
> index 0000000..7ad797c
> --- /dev/null
> +++ b/libavcodec/jvdec.c
[...]
> + */
> +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
> + case 1:
> + v[0] = get_bits(gb, 8);
> + for (j = 0; j < 2; j++)
> + memset(dst + j*linesize, v[0], 2);
> + break;
> + case 2:
> + v[0] = get_bits(gb, 8);
> + v[1] = get_bits(gb, 8);
> + for (j = 0; j < 2; j++)
> + for (i = 0; i < 2; i++)
and this
> + dst[j*linesize + i] = v[get_bits1(gb)];
> + break;
> + case 3:
> + for (j = 0; j < 2; j++)
> + for (i = 0; i < 2; i++)
> + dst[j*linesize + i] = get_bits(gb, 8);
> + }
> +}
> +
> +/**
> + * Decode 4x4 block
> + */
> +static void decode4x4(GetBitContext *gb, uint8_t *dst, int linesize)
> +{
> + int i, j, v[2];
> + switch(get_bits(gb, 2)) {
> + case 1:
> + v[0] = get_bits(gb, 8);
> + for (j = 0; j < 4; j++)
> + memset(dst + j*linesize, v[0], 4);
> + break;
> + case 2:
> + v[0] = get_bits(gb, 8);
> + v[1] = get_bits(gb, 8);
> + for (j = 2; j >= 0; j -= 2) {
> + for (i = 0; i < 4; i++)
> + dst[j*linesize + i] = v[get_bits1(gb)];
> + for (i = 0; i < 4; i++)
> + dst[(j+1)*linesize + i] = v[get_bits1(gb)];
> + }
are you sure it should be upside-down?
> + break;
> + case 3:
> + for (j = 0; j < 2; j++)
> + for (i = 0; i < 2; i++)
> + decode2x2(gb, dst + j*2*linesize + i*2, linesize);
> + }
> +}
> +
> +/**
> + * Decode 8x8 block
> + */
> +static void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPContext *dsp)
> +{
> + int i, j, v[2];
> + switch(get_bits(gb, 2)) {
> + case 1:
> + v[0] = get_bits(gb, 8);
> + dsp->fill_block_tab[1](dst, v[0], linesize, 8);
> + break;
> + case 2:
> + v[0] = get_bits(gb, 8);
> + v[1] = get_bits(gb, 8);
> + for (j = 7; j >= 0; j--)
> + for (i = 0; i < 8; i++)
> + dst[j*linesize + i] = v[get_bits1(gb)];
here too - why it's upside-down?
[the rest seems fine except for weird loop indents]
More information about the ffmpeg-devel
mailing list