[FFmpeg-devel] [PATCH] avcodec/get_bits: consider bit_size of 0 an error

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Oct 28 20:27:37 CET 2013



On 28.10.2013, at 17:26, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:

> On Mon, Oct 28, 2013 at 05:04:38PM +0000, Paul B Mahol wrote:
>> On 10/28/13, Reimar Doeffinger <Reimar.Doeffinger at gmx.de> wrote:
>>> On Mon, Oct 28, 2013 at 04:52:27PM +0000, Paul B Mahol wrote:
>>>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>>> 
>>> Could you add the reason for this change to the commit message?
>>> In theory being able to use 0 might work as an optimization in
>>> some cases, so I don't think supporting it is as nonsense as it
>>> might seem.
>> 
>> What kind of optimization?
> 
> Purely theoretical: You have a value A, depending on that following
> value B is either not encoded, encoded with 2, 5 or 8 bits.
> If get_bits supports 0 bits then you can just do something like
> get_bits(... (int){0, 2, 5, 8}[A]);
> if 0 is not allowed, you have to explicitly skip the get_bits for
> A == 0.

Forget this, it makes no sense and I completely misread your patch.
I at least withdraw my questions/objections.


More information about the ffmpeg-devel mailing list