diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-08-22 14:59:04 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-08-22 14:59:04 +0000 |
commit | c3bf0288c9bc119e41818fc4b94290d54c4bc5cb (patch) | |
tree | ca55f5f69dce47cfc8f4d7af4359afcedca282f1 /libavcodec/mpeg12.c | |
parent | a6aec9c94fe379068b6e959ea93779b3c2b5b73d (diff) | |
download | ffmpeg-c3bf0288c9bc119e41818fc4b94290d54c4bc5cb.tar.gz |
PSX MDEC decoder, based upon some code from Sebastian Jedruszkiewicz <elf at frogger dot rules dot pl>
note: completly untested, no demuxer yet
Originally committed as revision 2134 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 287846f2d4..438e709799 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -819,7 +819,7 @@ static VLC mb_ptype_vlc; static VLC mb_btype_vlc; static VLC mb_pat_vlc; -static void init_vlcs(MpegEncContext *s) +static void init_vlcs() { static int done = 0; @@ -1227,23 +1227,23 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred) return val; } -static inline int decode_dc(MpegEncContext *s, int component) +static inline int decode_dc(GetBitContext *gb, int component) { int code, diff; if (component == 0) { - code = get_vlc2(&s->gb, dc_lum_vlc.table, DC_VLC_BITS, 2); + code = get_vlc2(gb, dc_lum_vlc.table, DC_VLC_BITS, 2); } else { - code = get_vlc2(&s->gb, dc_chroma_vlc.table, DC_VLC_BITS, 2); + code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2); } if (code < 0){ - fprintf(stderr, "invalid dc code at %d %d\n", s->mb_x, s->mb_y); + fprintf(stderr, "invalid dc code at\n"); return 0xffff; } if (code == 0) { diff = 0; } else { - diff = get_xbits(&s->gb, code); + diff = get_xbits(gb, code); } return diff; } @@ -1261,7 +1261,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, /* DC coef */ component = (n <= 3 ? 0 : n - 4 + 1); - diff = decode_dc(s, component); + diff = decode_dc(&s->gb, component); if (diff >= 0xffff) return -1; dc = s->last_dc[component]; @@ -1498,7 +1498,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, quant_matrix = s->chroma_intra_matrix; component = n - 3; } - diff = decode_dc(s, component); + diff = decode_dc(&s->gb, component); if (diff >= 0xffff) return -1; dc = s->last_dc[component]; @@ -1570,7 +1570,7 @@ static int mpeg_decode_init(AVCodecContext *avctx) s->mpeg_enc_ctx.flags= avctx->flags; common_init(&s->mpeg_enc_ctx); - init_vlcs(&s->mpeg_enc_ctx); + init_vlcs(); s->mpeg_enc_ctx_allocated = 0; s->mpeg_enc_ctx.picture_number = 0; @@ -2477,3 +2477,8 @@ 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" |