diff mpeg12.c @ 7623:0bd920dcb7a5 libavcodec

Untangle mpeg12.c and mdec.c so that mdec.c can be compiled separately.
author diego
date Tue, 19 Aug 2008 20:52:26 +0000
parents c15e728fd413
children 1d04f38681bd
line wrap: on
line diff
--- a/mpeg12.c	Tue Aug 19 20:04:46 2008 +0000
+++ b/mpeg12.c	Tue Aug 19 20:52:26 2008 +0000
@@ -39,13 +39,11 @@
 //#include <assert.h>
 
 
-#define DC_VLC_BITS 9
 #define MV_VLC_BITS 9
 #define MBINCR_VLC_BITS 9
 #define MB_PAT_VLC_BITS 9
 #define MB_PTYPE_VLC_BITS 6
 #define MB_BTYPE_VLC_BITS 6
-#define TEX_VLC_BITS 9
 
 static inline int mpeg1_decode_block_inter(MpegEncContext *s,
                               DCTELEM *block,
@@ -144,15 +142,13 @@
 /******************************************/
 /* decoding */
 
-static VLC dc_lum_vlc;
-static VLC dc_chroma_vlc;
 static VLC mv_vlc;
 static VLC mbincr_vlc;
 static VLC mb_ptype_vlc;
 static VLC mb_btype_vlc;
 static VLC mb_pat_vlc;
 
-static av_cold void init_vlcs(void)
+av_cold void ff_init_vlcs(void)
 {
     static int done = 0;
 
@@ -620,27 +616,6 @@
     return val;
 }
 
-static inline int decode_dc(GetBitContext *gb, int component)
-{
-    int code, diff;
-
-    if (component == 0) {
-        code = get_vlc2(gb, dc_lum_vlc.table, DC_VLC_BITS, 2);
-    } else {
-        code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2);
-    }
-    if (code < 0){
-        av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
-        return 0xffff;
-    }
-    if (code == 0) {
-        diff = 0;
-    } else {
-        diff = get_xbits(gb, code);
-    }
-    return diff;
-}
-
 static inline int mpeg1_decode_block_intra(MpegEncContext *s,
                                DCTELEM *block,
                                int n)
@@ -1220,7 +1195,7 @@
     s->mpeg_enc_ctx.flags= avctx->flags;
     s->mpeg_enc_ctx.flags2= avctx->flags2;
     ff_mpeg12_common_init(&s->mpeg_enc_ctx);
-    init_vlcs();
+    ff_init_vlcs();
 
     s->mpeg_enc_ctx_allocated = 0;
     s->mpeg_enc_ctx.picture_number = 0;
@@ -2512,8 +2487,3 @@
 };
 
 #endif
-
-/* this is ugly i know, but the alternative is too make
-   hundreds of vars global and prefix them with ff_mpeg1_
-   which is far uglier. */
-#include "mdec.c"