[FFmpeg-devel] [PATCH] Optimization of original IFF codec
Ronald S. Bultje
rsbultje
Sun Apr 25 23:23:48 CEST 2010
Hi,
On Sun, Apr 25, 2010 at 5:15 PM, Sebastian Vater
<cdgs.basty at googlemail.com> wrote:
> Ronald S. Bultje a ?crit :
>> On Sun, Apr 25, 2010 at 12:47 PM, Sebastian Vater
>> <cdgs.basty at googlemail.com> wrote:
>>> + ? ?const unsigned b = (buf_size * 8) + bps - 1; \
>>
>> Shouldn't be const, I think (?).
>>
> Of course this should be const, since it isn't going to be changed. I
> moved this just out of the for, because gcc was too stupid to do the
> calculation outside of the loop.
Out of loop isn't the same as const. Const means it never changes,
ever. It means that the value is the same, regardless of input values
to the function call. So regardless of buf_size, bps, b always has the
same value.
Of course, that isn't the case, because it is calculated from them.
By moving the calculation outside the loop, gcc already knows to
calculate it only once, const isn't needed for that. gcc will not
calculate it for each loop iteration.
Ronald
More information about the ffmpeg-devel
mailing list