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

Frank Plowman post at frankplowman.com
Fri Oct 18 20:48:40 EEST 2024


On 15/10/2024 21:23, Frank Plowman wrote:
> 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.

It has been drawn to my attention that this is causing a failure for
VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic from the DVB VVC
test suite, due to the macro's use at
libavcodec/cbs_h266_syntax_template.c:1206

In light of the lack of performance difference between the two
implementations and the simplicity of the proposed change, I think the
bithack should be removed.

Cheers,
-- 
Frank


More information about the ffmpeg-devel mailing list