[FFmpeg-devel] [PATCH 2/2] libavcodec: Implementation of AC3 fixed point decoder

Michael Niedermayer michaelni at gmx.at
Fri Apr 12 19:50:28 CEST 2013


On Fri, Apr 12, 2013 at 06:50:45PM +0200, Christophe Gisquet wrote:
> 2013/4/12 Nedeljko Babic <Nedeljko.Babic at imgtec.com>:
> > AS for FP DSP functions, adding additional parameter that hold info about
> > used format would increase their usability, but it would also add some overhead
> > to functions (for example for calculating rounding) and it is maybe overkill at
> > this moment (since there is no code that uses other format).
> 
> My goal was rather to be able to do something like:
> 
> if( fp_dsp->dbits = 12 ) {
>   if( some_arch) {
>     s->round = ff_round_fp12_some_arch;
>     s->fmul_scalar = ff_fmul_scalar_fp12_some_arch;
>   }
> }
> 
> if( fp_dsp->dbits = 16 ) {
>   if( some_arch) {
>     s->round = ff_round_fp16_some_arch;
>     s->fmul_scalar = ff_fmul_scalar_fp16_some_arch;
>   }
> }
> 
> The AC3 FP code then sets or ask to initialize the FP DSP context with
> dbits = 12
> 
> Otherwise, the DSP context would get filled with every FP format needed:
> s->fmul_scalar_fp16(...)
> s->fmul_scalar_fp12(...)
> 
> But it seems there are cases where both are needed, hence the question
> on the 15 bits.

yet another option would be to use an array of function pointers

if (some_arch) {
    s->round      [FP12] = ff_round_fp12_some_arch;
    s->fmul_scalar[FP12] = ff_fmul_scalar_fp12_some_arch;
    s->round      [FP16] = ff_round_fp16_some_arch;
    s->fmul_scalar[FP16] = ff_fmul_scalar_fp16_some_arch;
}

and leave function pointers that are never used NULL

btw was it tested how much overhead pasing the bit parameter would
have ?
Iam asking because it would be more flexible
Some arch could have just 1 function and use the parameter while
another could be implemented like
if(bits ==12)
    ...
else if(bits == 16)
    ...


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130412/6595c1e4/attachment.asc>


More information about the ffmpeg-devel mailing list