[FFmpeg-devel] [PATCH 3/4] lavfi/nlmeans: Checking number precision when computing integral images

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Mar 6 15:15:42 EET 2019


2019-03-06 12:31 GMT+01:00, mypopy at gmail.com <mypopy at gmail.com>:
> On Wed, Mar 6, 2019 at 3:55 PM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>>
>> 2019-03-06 4:18 GMT+01:00, Jun Zhao <mypopydev at gmail.com>:

>> > +    // accumulation of 8-bits uint_8 (uint8_t *src) into 32-bits
>> > (uint32_t *ii)
>> > +    // data type, it will have a risk of an integral value becoming
>> > larger than
>> > +    // the 32-bits integer capacity and resulting in an integer
>> > overflow.
>> > +    if ((w * h * UINT8_MAX) > UINT32_MAX)
>>
>> I don't think UINT8_MAX increases readability and I suspect
>> this should contain "UINT32_MAX / (w*h)" or similar on
>> one side.
>>
> You means like: UINT32_MAX/w < (UINT8_MAX * h) ?

Actually: (UINT32_MAX / w < 255 * h)
(But that may only be me)

Carl Eugen


More information about the ffmpeg-devel mailing list