[FFmpeg-cvslog] r22204 - trunk/libavcodec/vp3.c

David Conrad lessen42
Thu Mar 4 21:21:18 CET 2010


On Mar 4, 2010, at 1:17 PM, M?ns Rullg?rd wrote:

> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> 
>> On Thu, Mar 04, 2010 at 11:01:03AM +0100, conrad wrote:
>>> Author: conrad
>>> Date: Thu Mar  4 11:01:03 2010
>>> New Revision: 22204
>>> 
>>> Log:
>>> Really fix 2.95
>>> 
>>> Modified:
>>>   trunk/libavcodec/vp3.c
>>> 
>>> Modified: trunk/libavcodec/vp3.c
>>> ==============================================================================
>>> --- trunk/libavcodec/vp3.c	Thu Mar  4 10:25:42 2010	(r22203)
>>> +++ trunk/libavcodec/vp3.c	Thu Mar  4 11:01:03 2010	(r22204)
>>> @@ -456,6 +456,7 @@ static void init_loop_filter(Vp3DecodeCo
>>>  */
>>> static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
>>> {
>>> +    int superblock_starts[3] = { 0, s->u_superblock_start, s->v_superblock_start };
>>>     int bit = 0;
>>>     int current_superblock = 0;
>>>     int current_run = 0;
>>> @@ -547,7 +548,7 @@ static int unpack_superblocks(Vp3DecodeC
>>>     memset(s->macroblock_coding, MODE_COPY, s->macroblock_count);
>>> 
>>>     for (plane = 0; plane < 3; plane++) {
>>> -        int sb_start = (int[3]){ 0, s->u_superblock_start, s->v_superblock_start }[plane];
>>> +        int sb_start = superblock_starts[plane];
>> 
>> Why are you moving the declaration up away from where it's used?
>> Is it relevantly faster or so?
> 
> Yes.  You don't want rebuild the array each iteration in the loop.
> The original code with the compound literal had that problem too.

It's not relevantly faster though, since it would be rebuilt only 3 times every slice. But I figured that if I'm splitting it up, no reason not to move it out of the loop too.



More information about the ffmpeg-cvslog mailing list