Justin Ruggles <[email protected]> writes:

> On 06/26/2011 05:01 PM, Måns Rullgård wrote:
>
>> Justin Ruggles <[email protected]> writes:
>> 
>>> diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
>>> index f6248a8..2e4b01a 100644
>>> --- a/libavcodec/ac3enc_template.c
>>> +++ b/libavcodec/ac3enc_template.c
>>> @@ -107,6 +107,20 @@ void AC3_NAME(apply_mdct)(AC3EncodeContext *s)
>>>  }
>>>
>>> +void AC3_NAME(clip_coefficients)(AC3EncodeContext *s)
>>> +{
>>> +#if CONFIG_AC3ENC_FLOAT
>>> +#define vector_clip_coef s->dsp.vector_clipf
>>> +#else
>>> +#define vector_clip_coef s->dsp.vector_clip_int32
>>> +#endif
>>> +    int chan_size = AC3_MAX_COEFS * AC3_MAX_BLOCKS;
>>> +    vector_clip_coef(s->mdct_coef_buffer + chan_size,
>>> +                     s->mdct_coef_buffer + chan_size,
>>> +                     COEF_MIN, COEF_MAX, chan_size * s->channels);
>>> +}
>> 
>> Would it perhaps be prettier to put this function in the _fixed/float.c
>> files instead?
>
> I could go either way with this... I have several other functions to add
> that have a similar pattern.  The point was to reduce code duplication,
> especially in separate files.  Another option would be to put the
> conditional parts in ac3enc.h.

It's just a single function call.  The duplication is scarcely larger than
the ifdeffery here.

BTW, I'm not too fond of the double-indirect calls here and elsewhere.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to