diff mpeg12.h @ 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 1d83e9c34641
children d6390123201d
line wrap: on
line diff
--- a/mpeg12.h	Tue Aug 19 20:04:46 2008 +0000
+++ b/mpeg12.h	Tue Aug 19 20:52:26 2008 +0000
@@ -24,8 +24,36 @@
 
 #include "mpegvideo.h"
 
+#define DC_VLC_BITS 9
+#define TEX_VLC_BITS 9
+
+static VLC dc_lum_vlc;
+static VLC dc_chroma_vlc;
+
 extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
 
 void ff_mpeg12_common_init(MpegEncContext *s);
+void ff_init_vlcs(void);
+
+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;
+}
 
 #endif /* FFMPEG_MPEG12_H */