[FFmpeg-devel] [PATCH] Unfinished GSoC qual task (16bit VQA Video Decoder)

Adam Iglewski adam.iglewski
Sat May 9 14:31:19 CEST 2009


Michael Niedermayer pisze:
[...]
>> And here I'v got a question about demuxing. Is it valid that
>> demuxer sends packet that contains no video to decoder?
> 
> its not good ...
> 
I thought so. Is "joining" packets to ensure that it contains
video in demuxer and then sending them to decoder is acceptable 
solution? If so I'm attaching patch

0004-Do-not-send-packets-with-no-video-data-to-decoder

If not what would be the correct way to fix this?

> 
>> +    if(!AV_RL16(&vqa_header[14]))
>> +        avctx->pix_fmt = PIX_FMT_RGB555;
>> +    else
>> +        avctx->pix_fmt = PIX_FMT_PAL8;
>> +
> 
> if(!x) a
> else   b
> 
> can be simplified to
> if(x) b
> else  a
> 

Fixed locally.

> 
[...]
>> +    if (!src[src_index] || src_size > 0xffff) {
>> +        new_format = 1;
>> +        src_index++;
>> +    }
> 
> int new_format = !src[0] || src_size > 0xffff;
> 
> if(new_format)
>     src_index++;
>

Fixed locally.
> 
> [...]
>> @@ -291,6 +308,86 @@ static void decode_format80(const unsigned char *src, int src_size,
>>                  dest_index, dest_size);
>>  }
>>  
>> +static inline void vqa_copy_hc_block(uint16_t *pixels,int stride,const uint16_t *codebook,
>> +                                      int block_h)
>> +{
>> +    while(block_h--) {
>> +        memcpy(pixels,codebook,8);
>> +        pixels += stride;
>> +        codebook += 4;
>> +    }
>> +}
>> +
>> +static void vqa_decode_hc_video_chunk(VqaContext *s,const unsigned char *src,unsigned int src_size)
>> +{
>> +    int block_x, block_y;          /* block width and height iterators */
>> +    int blocks_wide, blocks_high;  /* width and height in 4x4|2 blocks */
>> +    int block_inc;
>> +    int index_shift;
>> +    int i;
>> +
>> +    /* decoding parameters */
>> +    uint16_t *pixels,*frame_end;
>> +    uint16_t *codebook = (uint16_t *)s->codebook;
>> +    int stride = s->frame.linesize[0] >> 1;
>> +
>> +    int type,code;
>> +    int vector_index = 0;
>> +
>> +    blocks_wide = s->width >> 2;
>> +    blocks_high = s->height / s->vector_height;
>> +    block_inc = 4;
> 
>> +    frame_end = (uint16_t *)s->frame.data[0] + s->height * stride + s->width;
> 
> this likely doesnt work if stride is <0
> 

Sure but is it possible that linesize[0] is negative? There
are some codecs in FFmpeg that do similar calculations.

[...]
>> +
>> +            if(!type) {
>> +                    blocks_done = code;
>> +                    block_x += blocks_done;
>> +                    pixels += blocks_done * block_inc;
>> +                    continue;
> 
> indent should be 4 spaces
> 

Fixed locally.

>>  vqavideo.c |  118 +++++++++++++++++++------------------------------------------
>>  1 file changed, 38 insertions(+), 80 deletions(-)
>> 2c0d249f1dd11c66086648c2433c2d3bf7a63da2  0005-Simplf-decode_format80.patch
>> >From 8d1c315a8d3b3a68322eb309c4befe7f42462ff5 Mon Sep 17 00:00:00 2001
>> From: Adam Iglewski <adam.iglewski at gmail.com>
>> Date: Thu, 7 May 2009 00:09:49 +0200
>> Subject: [PATCH] Simplf decode_format80
> 
> This patch is pretty much unreviewable
> 
> [...]
> 
> 
> so is this
> 
> [...]
> 

Sorry about that. I'm sending them again. I hope this
time they are in more readable form. I split patch
that simplifies vqa_decode_chunk in two parts.
First one adds new functions and second
is rewrite of vqa_decode_chunk using those new
function.

And is there any other way to create readable
patches than adding new content with indent different
than in original file? And then fixing it in separate patch?

Regards,
Adam









More information about the ffmpeg-devel mailing list