[FFmpeg-devel] [PATCH] lavu/common: Fix AV_CEIL_RSHIFT for unsigned LHS

Frank Plowman post at frankplowman.com
Tue Oct 15 23:23:57 EEST 2024


On 14/10/2024 23:26, Michael Niedermayer wrote:
> On Sat, Oct 05, 2024 at 03:38:05PM -0700, Frank Plowman wrote:
>> The first branch of this ternary expression was intended to avoid
>> having two shift operations in the case the RHS is not known at
>> compile time.  It only works if the LHS has a signed type however,
>> otherwise the result is invalid.
> 
> If the expression is faster, why not check if its signed ?
> 
> if its not faster, then the argument could be that its not
> faster and removes complexity
> 
> thx
> 

In a quick microbenchmark (clang 16, AArch64), the bithack is 10% faster
with -O0 but there is no significant difference with -O1 and up.

Cheers,
-- 
Frank



More information about the ffmpeg-devel mailing list