[Mplayer-cvslog] CVS: main/libavcodec h263dec.c,1.1,1.2

Nick Kurshev nick at mplayer.dev.hu
Tue Jul 10 10:33:37 CEST 2001


Update of /cvsroot/mplayer/main/libavcodec
In directory mplayer:/var/tmp.root/cvs-serv2858/main/libavcodec

Modified Files:
	h263dec.c 
Log Message:
removing 'if' from loop. I hope that type of frame is not changed within a frame

Index: h263dec.c
===================================================================
RCS file: /cvsroot/mplayer/main/libavcodec/h263dec.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- h263dec.c	6 Jul 2001 03:32:40 -0000	1.1
+++ h263dec.c	10 Jul 2001 08:33:35 -0000	1.2
@@ -69,6 +69,12 @@
     return 0;
 }
 
+static void def_scale(MpegEncContext * s)
+{
+  s->y_dc_scale = 8;
+  s->c_dc_scale = 8;
+}
+
 static int h263_decode_frame(AVCodecContext *avctx, 
                              void *data, int *data_size,
                              UINT8 *buf, int buf_size)
@@ -76,7 +82,9 @@
     MpegEncContext *s = avctx->priv_data;
     int ret;
     DCTELEM block[6][64];
-    AVPicture *pict = data; 
+    AVPicture *pict = data;
+    void (*dc_scale)(MpegEncContext * s);
+    int (*decode_mb)(MpegEncContext *s, DCTELEM block[6][64]);
 
 #ifdef DEBUG
     printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
@@ -102,6 +110,13 @@
     if (ret < 0)
         return -1;
 
+    if (s->h263_msmpeg4) dc_scale=msmpeg4_dc_scale;
+    else if (s->h263_pred) dc_scale=h263_dc_scale;
+         else dc_scale=def_scale;
+
+    if (s->h263_msmpeg4) decode_mb=msmpeg4_decode_mb;
+    else                 decode_mb=h263_decode_mb;
+
     MPV_frame_start(s);
 
 #ifdef DEBUG
@@ -115,26 +130,11 @@
             printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
 #endif
             /* DCT & quantize */
-            if (s->h263_msmpeg4) {
-                msmpeg4_dc_scale(s);
-            } else if (s->h263_pred) {
-                h263_dc_scale(s);
-            } else {
-                /* default quantization values */
-                s->y_dc_scale = 8;
-                s->c_dc_scale = 8;
-            }
-
+	    (*dc_scale)(s);
             memset(block, 0, sizeof(block));
             s->mv_dir = MV_DIR_FORWARD;
             s->mv_type = MV_TYPE_16X16; 
-            if (s->h263_msmpeg4) {
-                if (msmpeg4_decode_mb(s, block) < 0)
-                    return -1;
-            } else {
-                if (h263_decode_mb(s, block) < 0)
-                    return -1;
-            }
+            if ((*msmpeg4_decode_mb)(s, block) < 0) return -1;
             MPV_decode_mb(s, block);
         }
     }




More information about the MPlayer-cvslog mailing list