[SCM] libav/experimental: simplify ff_h261_reorder_mb_index

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:42:04 UTC 2013


The following commit has been merged in the experimental branch:
commit 87b9e6b2dd32cff996532f5a0485befd672510a2
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Thu Oct 28 18:17:48 2004 +0000

    simplify ff_h261_reorder_mb_index
    
    Originally committed as revision 3649 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/h261.c b/libavcodec/h261.c
index 8a6b27f..8b73f38 100644
--- a/libavcodec/h261.c
+++ b/libavcodec/h261.c
@@ -150,38 +150,21 @@ static void h261_encode_gob_header(MpegEncContext * s, int mb_line){
 }
 
 void ff_h261_reorder_mb_index(MpegEncContext* s){
+    int index= s->mb_x + s->mb_y*s->mb_width;
+
+    if(index % 33 == 0)
+        h261_encode_gob_header(s,0);
+
     /* for CIF the GOB's are fragmented in the middle of a scanline
        that's why we need to adjust the x and y index of the macroblocks */
     if(ff_h261_get_picture_format(s->width,s->height) == 1){ // CIF
-        if((s->mb_x == 0 && (s->mb_y % 3 == 0) ) || (s->mb_x == 11 && ((s->mb_y -1 )% 3 == 0) ))
-            h261_encode_gob_header(s,0);
-        if(s->mb_x < 11 ){
-            if((s->mb_y % 3) == 1 ){
-                s->mb_x += 0;
-                s->mb_y += 1;
-            }
-            else if( (s->mb_y % 3) == 2 ){
-                s->mb_x += 11;
-                s->mb_y -= 1;
-            }
-        }
-        else{
-            if((s->mb_y % 3) == 1 ){
-                s->mb_x += 0;
-                s->mb_y -= 1;
-            }
-            else if( (s->mb_y % 3) == 0 ){
-                s->mb_x -= 11;
-                s->mb_y += 1;
-            }
-        }
+        s->mb_x =     index % 11 ; index /= 11;
+        s->mb_y =     index %  3 ; index /=  3;
+        s->mb_x+= 11*(index %  2); index /=  2;
+        s->mb_y+=  3*index;
+        
         ff_init_block_index(s);
         ff_update_block_index(s);
-    /* for QCIF we don't need to reorder MB's
-       there the GOB's aren't fragmented in the middle of a scanline */
-    }else if(ff_h261_get_picture_format(s->width,s->height) == 0){ // QCIF
-        if(s->mb_y % 3 == 0 && s->mb_x == 0)
-            h261_encode_gob_header(s,0);
     }
 }
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list