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

Nedeljko Babic Nedeljko.Babic at imgtec.com
Mon Apr 15 16:17:05 CEST 2013


>> > 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)
>    ...
I think that maybe it is better to use variant with function pointers
for every function instead using array of function pointers for now.
Currently there are just two or three functions of this type and it is 
not clear yet will there be any other functions of the same type.

It was not tested how much overhead passing the bit parameter would
have, but on our architecture it is one or two additional instructions
so basically it should not be a problem. I am more for this variant than 
for using pointers (or array of pointers) for rounding coefficients.


Thanks,
-Nedeljko


More information about the ffmpeg-devel mailing list