[FFmpeg-devel] [PATCHv4 1/4] lavc/h263dsp: add DCT dequantisation functions

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Jun 12 06:58:20 EEST 2024


Rémi Denis-Courmont:
> Le tiistaina 11. kesäkuuta 2024, 13.30.28 EEST Andreas Rheinhardt a écrit :
>>> +static void h263_dct_unquantize_intra_c(int16_t *block, size_t nCoeffs,
>>> +                                        int qmul, int qadd)
>>> +{
>>> +    if (nCoeffs > 0)
>>
>> Great, a branch.
> 
> Okay so you want sarcasms, have at it.
> 
> If you had ever looked at optimised compilations, you would have noticed that 
> optimising compiler emits that branch implicitly in scenarii like the current 
> code to deal with that case, thus rewriting the code as
> 
> if (nCoeffs > 0) {
>     do { ...; i++ } while (i < nCoeffs);
> }
> 
> This patch is simply making the branch explicit so we can share the otherwise 
> identical C code.

With the current code the initial branch can be avoided in the ac_pred case.

> 
>> Why don't you just use a signed type?
> 
> Just so you know, the correct type for positive sizes is size_t.
> You know, a size, like *not* a stride.
> 



More information about the ffmpeg-devel mailing list