[FFmpeg-cvslog] r14851 - in trunk/libavcodec: Makefile mdec.c mpeg12.c mpeg12.h
diego
subversion
Tue Aug 19 22:52:26 CEST 2008
Author: diego
Date: Tue Aug 19 22:52:26 2008
New Revision: 14851
Log:
Untangle mpeg12.c and mdec.c so that mdec.c can be compiled separately.
Modified:
trunk/libavcodec/Makefile
trunk/libavcodec/mdec.c
trunk/libavcodec/mpeg12.c
trunk/libavcodec/mpeg12.h
Modified: trunk/libavcodec/Makefile
==============================================================================
--- trunk/libavcodec/Makefile (original)
+++ trunk/libavcodec/Makefile Tue Aug 19 22:52:26 2008
@@ -120,7 +120,7 @@ OBJS-$(CONFIG_MP3ADU_DECODER) +
OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o mpeg4audio.o
OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MDEC_DECODER) += mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12data.o mpegvideo_enc.o motion_est.o ratecontrol.o mpeg12.o mpeg12data.o mpegvideo.o error_resilience.o
Modified: trunk/libavcodec/mdec.c
==============================================================================
--- trunk/libavcodec/mdec.c (original)
+++ trunk/libavcodec/mdec.c Tue Aug 19 22:52:26 2008
@@ -30,6 +30,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
+#include "mpeg12.h"
typedef struct MDECContext{
AVCodecContext *avctx;
@@ -223,7 +224,7 @@ static av_cold int decode_init(AVCodecCo
AVFrame *p= &a->picture;
mdec_common_init(avctx);
- init_vlcs();
+ ff_init_vlcs();
ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_zigzag_direct);
p->qstride= a->mb_width;
Modified: trunk/libavcodec/mpeg12.c
==============================================================================
--- trunk/libavcodec/mpeg12.c (original)
+++ trunk/libavcodec/mpeg12.c Tue Aug 19 22:52:26 2008
@@ -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 @@ void ff_mpeg1_clean_buffers(MpegEncConte
/******************************************/
/* 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 @@ static int mpeg_decode_motion(MpegEncCon
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 @@ static av_cold int mpeg_decode_init(AVCo
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 @@ AVCodec mpeg_xvmc_decoder = {
};
#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"
Modified: trunk/libavcodec/mpeg12.h
==============================================================================
--- trunk/libavcodec/mpeg12.h (original)
+++ trunk/libavcodec/mpeg12.h Tue Aug 19 22:52:26 2008
@@ -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 */
More information about the ffmpeg-cvslog
mailing list