[FFmpeg-devel] [PATCH 0/2] Origin Wing Commander IV video decoder

Måns Rullgård mans
Thu Feb 3 14:54:42 CET 2011


Benoit Fouet <benoit.fouet at free.fr> writes:

> Hi,
>
> On Thu, 03 Feb 2011 14:02:12 +0100 Diego Biurrun wrote:
>> On Thu, Feb 03, 2011 at 01:28:23PM +0100, Benoit Fouet wrote:
>> > On Thu, 03 Feb 2011 12:30:17 +0100 Diego Biurrun wrote:
>> > > On Thu, Feb 03, 2011 at 10:32:25AM +0100, Kostya wrote:
>> > > > +static int xan_unpack_luma(const uint8_t *src, int src_size, uint8_t *dst, int dst_size)
>> > > 
>> > > Long line; src_size and dst_size should be const.
>> > > 
>> > > > +   uint8_t *dst_end = dst + dst_size;
>> > > > +   const uint8_t *src_end = src + src_size;
>> > > 
>> > > dst_end should be const as well.
>> > > 
>> > > > +/* almost the same as in xan_wc3 decoder */
>> > > > +static int xan_unpack(uint8_t *dest, int dest_len, const uint8_t *src, int src_len)
>> > > 
>> > > Long line; dest_len and src_len should be const.
>> > 
>> > There is very little point in having them const.  Could you clarify why
>> > you want them to be?
>> 
>> I'm somewhat surprised by your question - because they are not changed
>> inside the function?  Was there ever another reason to declare something
>> const?
>> 
>
> And even though they were changed, why would that matter anyway?
> You're passing a value to the function, you don't care about it being
> modified or not. Do you really think that that will save 2 registers
> (or 2 int in the stack) when compiled with a const?

There is indeed not much point declaring parameter values as const.
The only advantage it brings is that the compiler will flag an error
if you accidentally modify them.

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



More information about the ffmpeg-devel mailing list