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

Rémi Denis-Courmont remi at remlab.net
Wed Jun 12 06:41:50 EEST 2024


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.

> 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.

-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the ffmpeg-devel mailing list