[FFmpeg-devel] [PATCH] Optimization of original IFF codec

Sebastian Vater cdgs.basty
Sun Apr 25 23:27:13 CEST 2010


Ronald S. Bultje a ?crit :
> 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.
>   
That's exactly what b is supposed to. Never changed, it's simply used as
loop end and after that the function exits anyway. ;)
> 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.
>   
Well, gcc could think that b is modified in the loop otherwise, const
tells the compiler to be 100% sure, it will ever be changed...and that's
what I want!

-- 

Best regards,
                   :-) Basty/CDGS (-:




More information about the ffmpeg-devel mailing list