diff vp3.c @ 1407:69f4f4fb8a50 libavcodec

fixing chroma MC minor cleanup postprocessing support
author michaelni
date Wed, 20 Aug 2003 07:35:23 +0000
parents ae5524a3cd08
children ca24abf4af22
line wrap: on
line diff
--- a/vp3.c	Tue Aug 19 17:10:00 2003 +0000
+++ b/vp3.c	Wed Aug 20 07:35:23 2003 +0000
@@ -288,6 +288,7 @@
     int last_coded_c_fragment;
 
     uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc
+    uint8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
 } Vp3DecodeContext;
 
 /************************************************************************
@@ -1186,6 +1187,8 @@
             s->inter_dequant[j] = MIN_DEQUANT_VAL * 2;
         s->inter_dequant[j] *= SCALER;
     }
+    
+    memset(s->qscale_table, (FFMAX(s->intra_y_dequant[1], s->intra_c_dequant[1])+8)/16, 512); //FIXME finetune
 
     /* print debug information as requested */
     debug_dequantizers("intra Y dequantizers:\n");
@@ -2403,29 +2406,22 @@
                     int src_x, src_y;
                     motion_x = s->all_fragments[i].motion_x;
                     motion_y = s->all_fragments[i].motion_y;
+                    if(plane){
+                        motion_x= (motion_x>>1) | (motion_x&1);
+                        motion_y= (motion_y>>1) | (motion_y&1);
+                    }
+
                     src_x= (motion_x>>1) + x;
                     src_y= (motion_y>>1) + y;
 if ((motion_x == 0xbeef) || (motion_y == 0xbeef))
 printf (" help! got beefy vector! (%X, %X)\n", motion_x, motion_y);
 
-                    if (motion_x >= 0) {
-                        motion_halfpel_index = motion_x & 0x01;
-                        motion_source += (motion_x >> 1);
-                    } else  {
-                        motion_x = -motion_x;
-                        motion_halfpel_index = motion_x & 0x01;
-                        motion_source -= ((motion_x + 1) >> 1);
-                    }
+                    motion_halfpel_index = motion_x & 0x01;
+                    motion_source += (motion_x >> 1);
 
 //                    motion_y = -motion_y;
-                    if (motion_y >= 0) {
-                        motion_halfpel_index |= (motion_y & 0x01) << 1;
-                        motion_source += ((motion_y >> 1) * stride);
-                    } else  {
-                        motion_y = -motion_y;
-                        motion_halfpel_index |= (motion_y & 0x01) << 1;
-                        motion_source -= (((motion_y + 1) >> 1) * stride);
-                    }
+                    motion_halfpel_index |= (motion_y & 0x01) << 1;
+                    motion_source += ((motion_y >> 1) * stride);
 
                     if(src_x<0 || src_y<0 || src_x + 9 >= width || src_y + 9 >= height){
                         uint8_t *temp= s->edge_emu_buffer;
@@ -2735,6 +2731,9 @@
         }
     }
 
+    s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
+    s->current_frame.qstride= 0;
+
     init_frame(s, &gb);
 
 #if KEYFRAMES_ONLY