[FFmpeg-devel] [PATCH][RFC] Indeo3 replacement

Maxim max_pole
Mon Jul 27 20:12:24 CEST 2009


Reimar D?ffinger schrieb:
> On Sun, Jul 26, 2009 at 11:16:22PM +0200, Maxim wrote:
>   
>> So, the code needs to manipulate the internal structs of the FFmpeg's
>> bitreader in order to achieve the same behaviour what's not really safe
>> IMHO. Maybe there is a possibility to do it smart. I don't know...
>>     
>
>
> Using
> align_get_bits
> gb.buffer[get_bits_count() >> 3]
>
> Isn't using internals and used elsewhere.
>
>   

Thanks Reimar! Just "align_get_bits" cannot be used directly because it
flashes all bits till the byte boundary but I need them later! The
proper working code will look like this:

if (bintree_code == VQ_DATA) {
    bits_remain = (8 - (get_bits_count(&gb) & 7)) & 7;
    if (bits_remain) temp = get_bits(&gb, bits_remain); // save all bits
until the byte boundary

    align_get_bits(&gb);
    data_ptr = gb->buffer[get_bits_count(&gb) >> 3];

    num_consumed_bytes = decode_cell(data_ptr,...);
    if (num_consumed_bytes < 0) ERROR;

    /* switch back to bitstream */
    init_get_bits(&gb, gb->buffer[num_consumed_bytes], size);

    /* now I need to insert the saved bits into the bitreader */
}

Do we have any code capable of inserting bits into the bitreader or is
there another way to achieve the same effect?

Regards
Maxim



More information about the ffmpeg-devel mailing list