[FFmpeg-cvslog] r24213 - trunk/libavcodec/dca.c

Måns Rullgård mans
Mon Jul 12 23:23:57 CEST 2010


Alex Converse <alex.converse at gmail.com> writes:

> 2010/7/12 M?ns Rullg?rd <mans at mansr.com>:
>> "Ronald S. Bultje" <rsbultje at gmail.com> writes:
>>
>>> Hi,
>>>
>>> 2010/7/12 M?ns Rullg?rd <mans at mansr.com>:
>>>> Vitor Sessak <vitor1001 at gmail.com> writes:
>>>>> On 07/12/2010 02:32 PM, benoit wrote:
>>>>>> Author: benoit
>>>>>> Date: Mon Jul 12 14:32:24 2010
>>>>>> New Revision: 24213
>>>>>>
>>>>>> Log:
>>>>>> Use math constant instead of hardcoded rounded value for sqrt(0.5).
>>>>>> Patch by Christophe.Gisquet (gmail)
>>>>>>
>>>>>> Modified:
>>>>>> ? ? trunk/libavcodec/dca.c
>>>>>>
>>>>>> Modified: trunk/libavcodec/dca.c
>>>>>> ==============================================================================
>>>>>> --- trunk/libavcodec/dca.c ? Mon Jul 12 12:17:20 2010 ? ? ? ?(r24212)
>>>>>> +++ trunk/libavcodec/dca.c ? Mon Jul 12 14:32:24 2010 ? ? ? ?(r24213)
>>>>>> @@ -1403,8 +1403,8 @@ static int dca_decode_frame(AVCodecConte
>>>>>> ? ? ? ? ? ? ? float* rt_chan ? = s->samples + s->channel_order_tab[s->xch_base_channel - 1] * 256;
>>>>>> ? ? ? ? ? ? ? int j;
>>>>>> ? ? ? ? ? ? ? for(j = 0; j< ?256; ++j) {
>>>>>> - ? ? ? ? ? ? ? ?lt_chan[j] -= (back_chan[j] - s->add_bias) * 0.707107f;
>>>>>> - ? ? ? ? ? ? ? ?rt_chan[j] -= (back_chan[j] - s->add_bias) * 0.707107f;
>>>>>> + ? ? ? ? ? ? ? ?lt_chan[j] -= (back_chan[j] - s->add_bias) * M_SQRT1_2;
>>>>>> + ? ? ? ? ? ? ? ?rt_chan[j] -= (back_chan[j] - s->add_bias) * M_SQRT1_2;
>>>>>
>>>>> Won't this patch make it use double-precision floating point math when
>>>>> not needed?
>>>>
>>>> Time for f-versions of those constants?
>>>
>>> They're defines, just add a "f" behind it when using it, e.g. M_SQRT1_2 f.
>>
>> That doesn't work. ?It has to be a single token.
>>
>
> A (float) cast should fold it to a float constant at compile time.

Sure, but it's ugly.  M_SQRT1_2f would IMO be nicer for the same
reasons the constant suffixes exist in the first place.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-cvslog mailing list