diff msmpeg4.c @ 2967:ef2149182f1c libavcodec

COSMETICS: Remove all trailing whitespace.
author diego
date Sat, 17 Dec 2005 18:14:38 +0000
parents 40765c51a7a9
children bfabfdf9ce55
line wrap: on
line diff
--- a/msmpeg4.c	Sat Dec 17 11:31:56 2005 +0000
+++ b/msmpeg4.c	Sat Dec 17 18:14:38 2005 +0000
@@ -30,11 +30,11 @@
 #include "mpegvideo.h"
 
 /*
- * You can also call this codec : MPEG4 with a twist ! 
+ * You can also call this codec : MPEG4 with a twist !
  *
- * TODO: 
+ * TODO:
  *        - (encoding) select best mv table (two choices)
- *        - (encoding) select best vlc/dc table 
+ *        - (encoding) select best vlc/dc table
  */
 //#define DEBUG
 
@@ -63,7 +63,7 @@
 static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                                        int n, int coded, const uint8_t *scantable);
 static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
-static int msmpeg4_decode_motion(MpegEncContext * s, 
+static int msmpeg4_decode_motion(MpegEncContext * s,
                                  int *mx_ptr, int *my_ptr);
 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val);
 static void init_h263_dc_for_msmpeg4(void);
@@ -119,14 +119,14 @@
     if (total == 0)
         total = 1;
     for(i=0;i<ST_NB;i++) {
-        printf("%-10s : %10.1f %5.1f%%\n", 
-               st_names[i], 
-               (double)st_bit_counts[i] / 8.0, 
+        printf("%-10s : %10.1f %5.1f%%\n",
+               st_names[i],
+               (double)st_bit_counts[i] / 8.0,
                (double)st_bit_counts[i] * 100.0 / total);
     }
     printf("%-10s : %10.1f %5.1f%%\n",
-           "total", 
-           (double)total / 8.0, 
+           "total",
+           (double)total / 8.0,
            100.0);
 
     printf("Output:\n");
@@ -136,14 +136,14 @@
     if (total == 0)
         total = 1;
     for(i=0;i<ST_NB;i++) {
-        printf("%-10s : %10.1f %5.1f%%\n", 
-               st_names[i], 
-               (double)st_out_bit_counts[i] / 8.0, 
+        printf("%-10s : %10.1f %5.1f%%\n",
+               st_names[i],
+               (double)st_out_bit_counts[i] / 8.0,
                (double)st_out_bit_counts[i] * 100.0 / total);
     }
     printf("%-10s : %10.1f %5.1f%%\n",
-           "total", 
-           (double)total / 8.0, 
+           "total",
+           (double)total / 8.0,
            100.0);
 }
 
@@ -156,7 +156,7 @@
 static void common_init(MpegEncContext * s)
 {
     static int inited=0;
-    
+
     switch(s->msmpeg4_version){
     case 1:
     case 2:
@@ -186,7 +186,7 @@
 
     }
 
-    
+
     if(s->msmpeg4_version>=4){
         ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , wmv1_scantable[1]);
         ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, wmv1_scantable[2]);
@@ -194,7 +194,7 @@
         ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , wmv1_scantable[0]);
     }
     //Note the default tables are set in common_init in mpegvideo.c
-    
+
     if(!inited){
         inited=1;
 
@@ -213,7 +213,7 @@
     /* mark all entries as not used */
     for(i=0;i<4096;i++)
         tab->table_mv_index[i] = tab->n;
-    
+
     for(i=0;i<tab->n;i++) {
         x = tab->table_mvx[i];
         y = tab->table_mvy[i];
@@ -269,14 +269,14 @@
     int size=0;
     int code;
     int run_diff= intra ? 0 : 1;
-    
+
     code = get_rl_index(rl, last, run, level);
     size+= rl->table_vlc[code][1];
     if (code == rl->n) {
         int level1, run1;
 
         level1 = level - rl->max_level[last][run];
-        if (level1 < 1) 
+        if (level1 < 1)
             goto esc2;
         code = get_rl_index(rl, last, run, level1);
         if (code == rl->n) {
@@ -318,7 +318,7 @@
         int size=0;
 
         if(i>0){// ;)
-            size++; 
+            size++;
             chroma_size++;
         }
         for(level=0; level<=MAX_LEVEL; level++){
@@ -330,7 +330,7 @@
                     int inter_count       = s->ac_stats[0][0][level][run][last] + s->ac_stats[0][1][level][run][last];
                     int intra_luma_count  = s->ac_stats[1][0][level][run][last];
                     int intra_chroma_count= s->ac_stats[1][1][level][run][last];
-                    
+
                     if(s->pict_type==I_TYPE){
                         size       += intra_luma_count  *rl_length[i  ][level][run][last];
                         chroma_size+= intra_chroma_count*rl_length[i+3][level][run][last];
@@ -338,7 +338,7 @@
                         size+=        intra_luma_count  *rl_length[i  ][level][run][last]
                                      +intra_chroma_count*rl_length[i+3][level][run][last]
                                      +inter_count       *rl_length[i+3][level][run][last];
-                    }                   
+                    }
                 }
                 if(last_size == size+chroma_size) break;
             }
@@ -353,16 +353,16 @@
         }
     }
 
-//    printf("type:%d, best:%d, qp:%d, var:%d, mcvar:%d, size:%d //\n", 
+//    printf("type:%d, best:%d, qp:%d, var:%d, mcvar:%d, size:%d //\n",
 //           s->pict_type, best, s->qscale, s->mb_var_sum, s->mc_mb_var_sum, best_size);
-           
+
     if(s->pict_type==P_TYPE) chroma_best= best;
 
     memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2);
 
     s->rl_table_index       =        best;
     s->rl_chroma_table_index= chroma_best;
-    
+
     if(s->pict_type != s->last_non_b_pict_type){
         s->rl_table_index= 2;
         if(s->pict_type==I_TYPE)
@@ -398,7 +398,7 @@
     if (s->pict_type == I_TYPE) {
         s->slice_height= s->mb_height/1;
         put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height);
-        
+
         if(s->msmpeg4_version==4){
             msmpeg4_encode_ext_header(s);
             if(s->bit_rate>MBAC_BITRATE)
@@ -415,7 +415,7 @@
         }
     } else {
         put_bits(&s->pb, 1, s->use_skip_mb_code);
-        
+
         if(s->msmpeg4_version==4 && s->bit_rate>MBAC_BITRATE)
             put_bits(&s->pb, 1, s->per_mb_rl_table);
 
@@ -461,18 +461,18 @@
     wrap = s->b8_stride;
 
     /* B C
-     * A X 
+     * A X
      */
     a = s->coded_block[xy - 1       ];
     b = s->coded_block[xy - 1 - wrap];
     c = s->coded_block[xy     - wrap];
-    
+
     if (b == c) {
         pred = a;
     } else {
         pred = c;
     }
-    
+
     /* store value */
     *coded_block_ptr = &s->coded_block[xy];
 
@@ -481,7 +481,7 @@
 
 #ifdef CONFIG_ENCODERS
 
-static void msmpeg4_encode_motion(MpegEncContext * s, 
+static void msmpeg4_encode_motion(MpegEncContext * s,
                                   int mx, int my)
 {
     int code;
@@ -498,20 +498,20 @@
         my += 64;
     else if (my >= 64)
         my -= 64;
-    
+
     mx += 32;
     my += 32;
 #if 0
     if ((unsigned)mx >= 64 ||
-        (unsigned)my >= 64) 
+        (unsigned)my >= 64)
         fprintf(stderr, "error mx=%d my=%d\n", mx, my);
 #endif
     mv = &mv_tables[s->mv_table_index];
 
     code = mv->table_mv_index[(mx << 6) | my];
     set_stat(ST_MV);
-    put_bits(&s->pb, 
-             mv->table_mv_bits[code], 
+    put_bits(&s->pb,
+             mv->table_mv_bits[code],
              mv->table_mv_code[code]);
     if (code == mv->n) {
         /* escape : code litterally */
@@ -528,12 +528,12 @@
             }
             s->first_slice_line = 1;
         } else {
-            s->first_slice_line = 0; 
+            s->first_slice_line = 0;
         }
     }
 }
 
-void msmpeg4_encode_mb(MpegEncContext * s, 
+void msmpeg4_encode_mb(MpegEncContext * s,
                        DCTELEM block[6][64],
                        int motion_x, int motion_y)
 {
@@ -542,7 +542,7 @@
     uint8_t *coded_block;
 
     handle_slices(s);
-    
+
     if (!s->mb_intra) {
 	/* compute cbp */
         set_stat(ST_INTER_MB);
@@ -562,16 +562,16 @@
 	}
         if (s->use_skip_mb_code)
             put_bits(&s->pb, 1, 0);	/* mb coded */
-        
+
         if(s->msmpeg4_version<=2){
-            put_bits(&s->pb, 
-                     v2_mb_type[cbp&3][1], 
+            put_bits(&s->pb,
+                     v2_mb_type[cbp&3][1],
                      v2_mb_type[cbp&3][0]);
             if((cbp&3) != 3) coded_cbp= cbp ^ 0x3C;
             else             coded_cbp= cbp;
 
-            put_bits(&s->pb, 
-                     cbpy_tab[coded_cbp>>2][1], 
+            put_bits(&s->pb,
+                     cbpy_tab[coded_cbp>>2][1],
                      cbpy_tab[coded_cbp>>2][0]);
 
             s->misc_bits += get_bits_diff(s);
@@ -580,15 +580,15 @@
             msmpeg4v2_encode_motion(s, motion_x - pred_x);
             msmpeg4v2_encode_motion(s, motion_y - pred_y);
         }else{
-            put_bits(&s->pb, 
-                     table_mb_non_intra[cbp + 64][1], 
+            put_bits(&s->pb,
+                     table_mb_non_intra[cbp + 64][1],
                      table_mb_non_intra[cbp + 64][0]);
 
             s->misc_bits += get_bits_diff(s);
 
             /* motion vector */
             h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-            msmpeg4_encode_motion(s, motion_x - pred_x, 
+            msmpeg4_encode_motion(s, motion_x - pred_x,
                                   motion_y - pred_y);
         }
 
@@ -621,29 +621,29 @@
 
         if(s->msmpeg4_version<=2){
             if (s->pict_type == I_TYPE) {
-                put_bits(&s->pb, 
+                put_bits(&s->pb,
                          v2_intra_cbpc[cbp&3][1], v2_intra_cbpc[cbp&3][0]);
             } else {
                 if (s->use_skip_mb_code)
                     put_bits(&s->pb, 1, 0);	/* mb coded */
-                put_bits(&s->pb, 
-                         v2_mb_type[(cbp&3) + 4][1], 
+                put_bits(&s->pb,
+                         v2_mb_type[(cbp&3) + 4][1],
                          v2_mb_type[(cbp&3) + 4][0]);
             }
             put_bits(&s->pb, 1, 0);	/* no AC prediction yet */
-            put_bits(&s->pb, 
-                     cbpy_tab[cbp>>2][1], 
+            put_bits(&s->pb,
+                     cbpy_tab[cbp>>2][1],
                      cbpy_tab[cbp>>2][0]);
         }else{
             if (s->pict_type == I_TYPE) {
                 set_stat(ST_INTRA_MB);
-                put_bits(&s->pb, 
+                put_bits(&s->pb,
                          ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]);
             } else {
                 if (s->use_skip_mb_code)
                     put_bits(&s->pb, 1, 0);	/* mb coded */
-                put_bits(&s->pb, 
-                         table_mb_non_intra[cbp][1], 
+                put_bits(&s->pb,
+                         table_mb_non_intra[cbp][1],
                          table_mb_non_intra[cbp][0]);
             }
             set_stat(ST_INTRA_MB);
@@ -665,7 +665,7 @@
 
 #endif //CONFIG_ENCODERS
 
-static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n, 
+static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
                                     int32_t **dc_val_ptr)
 {
     int i;
@@ -675,9 +675,9 @@
     } else {
         i= n-3;
     }
-    
+
     *dc_val_ptr= &s->last_dc[i];
-    return s->last_dc[i]; 
+    return s->last_dc[i];
 }
 
 static int get_dc(uint8_t *src, int stride, int scale)
@@ -694,7 +694,7 @@
 }
 
 /* dir = 0: left, dir = 1: top prediction */
-static inline int msmpeg4_pred_dc(MpegEncContext * s, int n, 
+static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
                              uint16_t **dc_val_ptr, int *dir_ptr)
 {
     int a, b, c, wrap, pred, scale;
@@ -706,17 +706,17 @@
     } else {
 	scale = s->c_dc_scale;
     }
-    
+
     wrap = s->block_wrap[n];
     dc_val= s->dc_val[0] + s->block_index[n];
 
     /* B C
-     * A X 
+     * A X
      */
     a = dc_val[ - 1];
     b = dc_val[ - 1 - wrap];
     c = dc_val[ - wrap];
-    
+
     if(s->first_slice_line && (n&2)==0 && s->msmpeg4_version<4){
         b=c=1024;
     }
@@ -765,7 +765,7 @@
         if(s->inter_intra_pred){
             uint8_t *dest;
             int wrap;
-            
+
             if(n==1){
                 pred=a;
                 *dir_ptr = 0;
@@ -792,7 +792,7 @@
                 else           a= get_dc(dest-8, wrap, scale*8);
                 if(s->mb_y==0) c= (1024 + (scale>>1))/scale;
                 else           c= get_dc(dest-8*wrap, wrap, scale*8);
-                
+
                 if (s->h263_aic_dir==0) {
                     pred= a;
                     *dir_ptr = 0;
@@ -851,7 +851,7 @@
     if(s->msmpeg4_version==1){
         int32_t *dc_val;
         pred = msmpeg4v1_pred_dc(s, n, &dc_val);
-        
+
         /* update predictor */
         *dc_val= level;
     }else{
@@ -871,11 +871,11 @@
 
     if(s->msmpeg4_version<=2){
         if (n < 4) {
-            put_bits(&s->pb, 
+            put_bits(&s->pb,
                      v2_dc_lum_table[level+256][1],
                      v2_dc_lum_table[level+256][0]);
         }else{
-            put_bits(&s->pb, 
+            put_bits(&s->pb,
                      v2_dc_chroma_table[level+256][1],
                      v2_dc_chroma_table[level+256][0]);
         }
@@ -886,7 +886,7 @@
             sign = 1;
         }
         code = level;
-        if (code > DC_MAX) 
+        if (code > DC_MAX)
             code = DC_MAX;
 
         if (s->dc_table_index == 0) {
@@ -902,10 +902,10 @@
                 put_bits(&s->pb, ff_table1_dc_chroma[code][1], ff_table1_dc_chroma[code][0]);
             }
         }
-            
+
         if (code == DC_MAX)
             put_bits(&s->pb, 8, level);
-            
+
         if (level != 0) {
             put_bits(&s->pb, 1, sign);
         }
@@ -982,7 +982,7 @@
                 int level1, run1;
 
                 level1 = level - rl->max_level[last][run];
-                if (level1 < 1) 
+                if (level1 < 1)
                     goto esc2;
                 code = get_rl_index(rl, last, run, level1);
                 if (code == rl->n) {
@@ -1092,7 +1092,7 @@
             uni_code= DCtab_chrom[size][0];
             uni_len = DCtab_chrom[size][1];
             uni_code ^= (1<<uni_len)-1; //M$ doesnt like compatibility
-            
+
             if (size > 0) {
                 uni_code<<=size; uni_code|=l;
                 uni_len+=size;
@@ -1125,31 +1125,31 @@
         }
         for(i=0;i<2;i++) {
             mv = &mv_tables[i];
-            init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1, 
+            init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1,
                      mv->table_mv_bits, 1, 1,
                      mv->table_mv_code, 2, 2, 1);
         }
 
-        init_vlc(&ff_msmp4_dc_luma_vlc[0], DC_VLC_BITS, 120, 
+        init_vlc(&ff_msmp4_dc_luma_vlc[0], DC_VLC_BITS, 120,
                  &ff_table0_dc_lum[0][1], 8, 4,
                  &ff_table0_dc_lum[0][0], 8, 4, 1);
-        init_vlc(&ff_msmp4_dc_chroma_vlc[0], DC_VLC_BITS, 120, 
+        init_vlc(&ff_msmp4_dc_chroma_vlc[0], DC_VLC_BITS, 120,
                  &ff_table0_dc_chroma[0][1], 8, 4,
                  &ff_table0_dc_chroma[0][0], 8, 4, 1);
-        init_vlc(&ff_msmp4_dc_luma_vlc[1], DC_VLC_BITS, 120, 
+        init_vlc(&ff_msmp4_dc_luma_vlc[1], DC_VLC_BITS, 120,
                  &ff_table1_dc_lum[0][1], 8, 4,
                  &ff_table1_dc_lum[0][0], 8, 4, 1);
-        init_vlc(&ff_msmp4_dc_chroma_vlc[1], DC_VLC_BITS, 120, 
+        init_vlc(&ff_msmp4_dc_chroma_vlc[1], DC_VLC_BITS, 120,
                  &ff_table1_dc_chroma[0][1], 8, 4,
                  &ff_table1_dc_chroma[0][0], 8, 4, 1);
-    
-        init_vlc(&v2_dc_lum_vlc, DC_VLC_BITS, 512, 
+
+        init_vlc(&v2_dc_lum_vlc, DC_VLC_BITS, 512,
                  &v2_dc_lum_table[0][1], 8, 4,
                  &v2_dc_lum_table[0][0], 8, 4, 1);
-        init_vlc(&v2_dc_chroma_vlc, DC_VLC_BITS, 512, 
+        init_vlc(&v2_dc_chroma_vlc, DC_VLC_BITS, 512,
                  &v2_dc_chroma_table[0][1], 8, 4,
                  &v2_dc_chroma_table[0][0], 8, 4, 1);
-    
+
         init_vlc(&cbpy_vlc, CBPY_VLC_BITS, 16,
                  &cbpy_tab[0][1], 2, 1,
                  &cbpy_tab[0][0], 2, 1, 1);
@@ -1164,27 +1164,27 @@
                  &mvtab[0][0], 2, 1, 1);
 
         for(i=0; i<4; i++){
-            init_vlc(&mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128, 
+            init_vlc(&mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128,
                      &wmv2_inter_table[i][0][1], 8, 4,
                      &wmv2_inter_table[i][0][0], 8, 4, 1); //FIXME name?
         }
-        
-        init_vlc(&ff_msmp4_mb_i_vlc, MB_INTRA_VLC_BITS, 64, 
+
+        init_vlc(&ff_msmp4_mb_i_vlc, MB_INTRA_VLC_BITS, 64,
                  &ff_msmp4_mb_i_table[0][1], 4, 2,
                  &ff_msmp4_mb_i_table[0][0], 4, 2, 1);
-        
-        init_vlc(&v1_intra_cbpc_vlc, V1_INTRA_CBPC_VLC_BITS, 8, 
+
+        init_vlc(&v1_intra_cbpc_vlc, V1_INTRA_CBPC_VLC_BITS, 8,
                  intra_MCBPC_bits, 1, 1,
                  intra_MCBPC_code, 1, 1, 1);
-        init_vlc(&v1_inter_cbpc_vlc, V1_INTER_CBPC_VLC_BITS, 25, 
+        init_vlc(&v1_inter_cbpc_vlc, V1_INTER_CBPC_VLC_BITS, 25,
                  inter_MCBPC_bits, 1, 1,
                  inter_MCBPC_code, 1, 1, 1);
-        
-        init_vlc(&inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, 
+
+        init_vlc(&inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
                  &table_inter_intra[0][1], 2, 1,
                  &table_inter_intra[0][0], 2, 1, 1);
     }
-    
+
     switch(s->msmpeg4_version){
     case 1:
     case 2:
@@ -1200,9 +1200,9 @@
         //FIXME + TODO VC9 decode mb
         break;
     }
-    
+
     s->slice_height= s->mb_height; //to avoid 1/0 if the first frame isnt a keyframe
-    
+
     return 0;
 }
 
@@ -1252,7 +1252,7 @@
     }
 
     if (s->pict_type == I_TYPE) {
-        code = get_bits(&s->gb, 5); 
+        code = get_bits(&s->gb, 5);
         if(s->msmpeg4_version==1){
             if(code==0 || code>s->mb_height){
                 av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code);
@@ -1289,7 +1289,7 @@
 
             if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
             else                           s->per_mb_rl_table= 0;
-            
+
             if(!s->per_mb_rl_table){
                 s->rl_chroma_table_index = decode012(&s->gb);
                 s->rl_table_index = decode012(&s->gb);
@@ -1301,10 +1301,10 @@
         }
         s->no_rounding = 1;
         if(s->avctx->debug&FF_DEBUG_PICT_INFO)
-	    av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d   \n", 
+	    av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d   \n",
 		s->qscale,
 		s->rl_chroma_table_index,
-		s->rl_table_index, 
+		s->rl_table_index,
 		s->dc_table_index,
                 s->per_mb_rl_table,
                 s->slice_height);
@@ -1347,12 +1347,12 @@
             s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
             break;
         }
-        
+
         if(s->avctx->debug&FF_DEBUG_PICT_INFO)
-	    av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d   \n", 
-		s->use_skip_mb_code, 
-		s->rl_table_index, 
-		s->rl_chroma_table_index, 
+	    av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d   \n",
+		s->use_skip_mb_code,
+		s->rl_table_index,
+		s->rl_chroma_table_index,
 		s->dc_table_index,
 		s->mv_table_index,
                 s->per_mb_rl_table,
@@ -1440,7 +1440,7 @@
         code = (val >> bit_size) + 1;
         bits = val & (range - 1);
 
-        put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign); 
+        put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign);
         if (bit_size > 0) {
             put_bits(&s->pb, bit_size, bits);
         }
@@ -1482,7 +1482,7 @@
 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
 {
     int cbp, code, i;
-    
+
     if (s->pict_type == P_TYPE) {
         if (s->use_skip_mb_code) {
             if (get_bits1(&s->gb)) {
@@ -1509,7 +1509,7 @@
         }
 
         s->mb_intra = code >>2;
-    
+
         cbp = code & 0x3;
     } else {
         s->mb_intra = 1;
@@ -1525,7 +1525,7 @@
 
     if (!s->mb_intra) {
         int mx, my, cbpy;
-        
+
         cbpy= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
         if(cbpy<0){
             av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
@@ -1534,11 +1534,11 @@
 
         cbp|= cbpy<<2;
         if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C;
-        
+
         h263_pred_motion(s, 0, 0, &mx, &my);
         mx= msmpeg4v2_decode_motion(s, mx, 1);
         my= msmpeg4v2_decode_motion(s, my, 1);
-        
+
         s->mv_dir = MV_DIR_FORWARD;
         s->mv_type = MV_TYPE_16X16;
         s->mv[0][0][0] = mx;
@@ -1589,13 +1589,13 @@
                 return 0;
             }
         }
-        
+
         code = get_vlc2(&s->gb, mb_non_intra_vlc[DEFAULT_INTER_INDEX].table, MB_NON_INTRA_VLC_BITS, 3);
         if (code < 0)
             return -1;
 	//s->mb_intra = (code & 0x40) ? 0 : 1;
 	s->mb_intra = (~code & 0x40) >> 6;
-            
+
         cbp = code & 0x3f;
     } else {
         set_stat(ST_INTRA_MB);
@@ -1655,7 +1655,7 @@
 	    return -1;
 	}
     }
-    
+
     return 0;
 }
 //#define ERROR_DETAILS
@@ -1675,7 +1675,7 @@
 	/* DC coef */
         set_stat(ST_DC);
         level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
-        
+
         if (level < 0){
             av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
             if(s->inter_intra_pred) level=0;
@@ -1702,7 +1702,7 @@
             goto not_coded;
         }
         if (s->ac_pred) {
-            if (dc_pred_dir == 0) 
+            if (dc_pred_dir == 0)
                 scan_table = s->intra_v_scantable.permutated; /* left */
             else
                 scan_table = s->intra_h_scantable.permutated; /* top */
@@ -1750,7 +1750,7 @@
                         run=   SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
                         level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8);
                         SKIP_COUNTER(re, &s->gb, 1+6+8);
-                    }else{                        
+                    }else{
                         int sign;
                         last=  SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
                         if(!s->esc3_level_length){
@@ -1777,13 +1777,13 @@
 //printf("level length:%d, run length: %d\n", ll, s->esc3_run_length);
                             UPDATE_CACHE(re, &s->gb);
                         }
-                        run=   SHOW_UBITS(re, &s->gb, s->esc3_run_length); 
+                        run=   SHOW_UBITS(re, &s->gb, s->esc3_run_length);
                         SKIP_BITS(re, &s->gb, s->esc3_run_length);
-                        
-                        sign=  SHOW_UBITS(re, &s->gb, 1); 
+
+                        sign=  SHOW_UBITS(re, &s->gb, 1);
                         SKIP_BITS(re, &s->gb, 1);
-                        
-                        level= SHOW_UBITS(re, &s->gb, s->esc3_level_length); 
+
+                        level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
                         SKIP_BITS(re, &s->gb, s->esc3_level_length);
                         if(sign) level= -level;
                     }
@@ -1905,7 +1905,7 @@
     }
     if(s->msmpeg4_version>=4 && i>0) i=63; //FIXME/XXX optimize
     s->block_last_index[n] = i;
-    
+
     return 0;
 }
 
@@ -1919,7 +1919,7 @@
         } else {
             level = get_vlc2(&s->gb, v2_dc_chroma_vlc.table, DC_VLC_BITS, 3);
         }
-        if (level < 0) 
+        if (level < 0)
             return -1;
         level-=256;
     }else{  //FIXME optimize use unified tables & index
@@ -1947,7 +1947,7 @@
         int32_t *dc_val;
         pred = msmpeg4v1_pred_dc(s, n, &dc_val);
         level += pred;
-        
+
         /* update predictor */
         *dc_val= level;
     }else{
@@ -1966,7 +1966,7 @@
     return level;
 }
 
-static int msmpeg4_decode_motion(MpegEncContext * s, 
+static int msmpeg4_decode_motion(MpegEncContext * s,
                                  int *mx_ptr, int *my_ptr)
 {
     MVTable *mv;
@@ -2007,6 +2007,6 @@
 
 /* cleanest way to support it
  * there is too much shared between versions so that we cant have 1 file per version & 1 common
- * as allmost everything would be in the common file 
+ * as allmost everything would be in the common file
  */
 #include "wmv2.c"