[FFmpeg-devel] [PATCH][RFC] Lagarith Decoder.

Måns Rullgård mans
Fri Aug 7 00:23:57 CEST 2009


Alexander Strange <astrange at ithinksw.com> writes:

> On Aug 6, 2009, at 5:06 PM, Nathan Caldwell wrote:
>
>> Here's my first attempt at a Lagarith decoder. At the moment it only
>> handles YV12 content, I do plan on adding in the other modes (RGB24,
>> YUY2, and RGBA). I just wanted some input on things that need changed
>> before I get too far along.
>>
>> +static inline uint32_t clp2(uint32_t x)
>
> This name is kind of obscure.

Furthermore, this is generic enough that it could be useful somewhere
else some time.  It should go in some header file with other similar
stuff.  It can also be easily optimised on CPUs with bit-counting
instructions (e.g. CLZ).

>> +    if ( (signed int)scaled_cumul_prob < 0 ){
>
> This might not pass -Wstrict-overflow, try > INT_MAX.

Worse, it invokes undefined behaviour according to the C standard.
GCC sometimes sees fit assume such tests will always be false, with
rather unexpected consequences.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list