[Ffmpeg-devel] gcc 2.95 doesn't like snow.c

Alexander Strasser eclipse7
Fri Dec 30 18:13:31 CET 2005


Fran?ois Revol wrote:
> 
> libavcodec/snow.c:3174: invalid use of non-lvalue array
> 
> either it's a gcc3 extention or whatever, but it doesn't work here.
> I worked around it that way:
> 
> - check_block(s, mb_x, mb_y, (int[2]){block->mx, block->my}, 0, &
> best_rd);
> + check_block(s, mb_x, mb_y, ({int p[2] = {block->mx, block->my}; p;}),
> 0, &best_rd);
> 
> ... 9 others like this
> 
> If you don't have any better fix I'll commit it next week.

  Here is a C89 compliant way to fix it. Choose your poison ;)

  Alex (beastd)

P.S. i think the block i added could be properly indented
     right away; cause the lines in between get replaced anyway
-------------- next part --------------
Index: libavcodec/snow.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/snow.c,v
retrieving revision 1.71
diff -u -r1.71 snow.c
--- libavcodec/snow.c	29 Dec 2005 02:17:51 -0000	1.71
+++ libavcodec/snow.c	30 Dec 2005 17:05:55 -0000
@@ -3170,13 +3170,27 @@
                     memset(s->me_cache, 0, sizeof(s->me_cache));
                 s->me_cache_generation += 1<<22;
 
+            {
+                int block_mv[2];
                 // get previous score (cant be cached due to OBMC)
-                check_block(s, mb_x, mb_y, (int[2]){block->mx, block->my}, 0, &best_rd);
-                check_block(s, mb_x, mb_y, (int[2]){0, 0}, 0, &best_rd);
-                check_block(s, mb_x, mb_y, (int[2]){tb->mx, tb->my}, 0, &best_rd);
-                check_block(s, mb_x, mb_y, (int[2]){lb->mx, lb->my}, 0, &best_rd);
-                check_block(s, mb_x, mb_y, (int[2]){rb->mx, rb->my}, 0, &best_rd);
-                check_block(s, mb_x, mb_y, (int[2]){bb->mx, bb->my}, 0, &best_rd);
+                block_mv[0] = block->mx;  block_mv[1] = block->my;
+                check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+
+                block_mv[0] = 0;          block_mv[1] = 0;
+                check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                
+                block_mv[0] = tb->mx;     block_mv[1] = tb->my;
+                check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+
+                block_mv[0] = lb->mx;     block_mv[1] = lb->my;
+                check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                
+                block_mv[0] = rb->mx;     block_mv[1] = rb->my;
+                check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                
+                block_mv[0] = bb->mx;     block_mv[1] = bb->my;
+                check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+            }
 
                 /* fullpel ME */
                 //FIXME avoid subpel interpol / round to nearest integer
@@ -3184,10 +3198,19 @@
                     dia_change=0;
                     for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
                         for(j=0; j<i; j++){
-                            dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my+(4*j)}, 0, &best_rd);
-                            dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my-(4*j)}, 0, &best_rd);
-                            dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my-(4*j)}, 0, &best_rd);
-                            dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my+(4*j)}, 0, &best_rd);
+                            int block_mv[2];
+
+                            block_mv[0] = block->mx+4*(i-j);  block_mv[1] = block->my+(4*j);
+                            dia_change |= check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                            
+                            block_mv[0] = block->mx-4*(i-j);  block_mv[1] = block->my-(4*j);
+                            dia_change |= check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                            
+                            block_mv[0] = block->mx+4*(i-j);  block_mv[1] = block->my-(4*j);
+                            dia_change |= check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                            
+                            block_mv[0] = block->mx-4*(i-j);  block_mv[1] = block->my+(4*j);
+                            dia_change |= check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
                         }
                     }
                 }while(dia_change);
@@ -3195,8 +3218,12 @@
                 do{
                     static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
                     dia_change=0;
-                    for(i=0; i<8; i++)
-                        dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+square[i][0], block->my+square[i][1]}, 0, &best_rd);
+                    for(i=0; i<8; i++){                    
+                        int block_mv[2];
+
+                        block_mv[0] = block->mx+square[i][0];  block_mv[1] = block->my+square[i][1];
+                        dia_change |= check_block(s, mb_x, mb_y, block_mv, 0, &best_rd);
+                    }
                 }while(dia_change);
                 //FIXME or try the standard 2 pass qpel or similar
 



More information about the ffmpeg-devel mailing list