[FFmpeg-devel] [PATCH] AAC: unroll parts of decode_spectrum_and_dequant()
Måns Rullgård
mans
Tue Dec 9 18:27:24 CET 2008
M?ns Rullg?rd wrote:
>
> Michael Niedermayer wrote:
>> On Mon, Dec 08, 2008 at 08:04:10PM -0800, Jason Garrett-Glaser wrote:
>>> On Mon, Dec 8, 2008 at 7:58 PM, Jason Garrett-Glaser
>>> <darkshikari at gmail.com> wrote:
>>> > if (vq_ptr[2]) coef[coef_tmp_idx + 2] = 1 - 2*(int)get_bits1(gb);
>>> > if (vq_ptr[3]) coef[coef_tmp_idx + 3] = 1 - 2*(int)get_bits1(gb);
>>> >
>>> > Isn't that a rather unnecessary int -> float conversion? I'd think
>>> > you could do much better than that considering there are only two
>>> > possible input values...
>>> >
>>> > Dark Shikari
>>> >
>>>
>>> Simple proposal for the above:
>>>
>>> static const float lookup[2] = {1.0, -1.0};
>>> if (vq_ptr[2]) coef[coef_tmp_idx + 2] = lookup[get_bits1(gb)];
>>
>>
>> something like:
>> if (vq_ptr[2]) ((uint32_t*)coef)[coef_tmp_idx + 2] = (get_bits1(gb)<<31) +
>> 0x3F800000;
>>
>> might be even faster
>> but i agree with robert that this should be a seperate patch
>
> Strict aliasing violation. Depending on CPU it might also be slower.
> Most FPUs can generate +-1 constants efficiently.
I meant that something like this could be faster:
if (vq_ptr[2]) coef[coef_tmp_idx + 2] = get_bits1(gb)? -1.0 : 1.0;
IMO it deserves testing.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list