Commit 1106e4ab authored by Baptiste Coudurier's avatar Baptiste Coudurier Committed by Michael Niedermayer

remove MpegEncContext, patch by baptiste

approved by me already but apparently forgotten

Originally committed as revision 8733 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 859d95ba
...@@ -839,7 +839,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in ...@@ -839,7 +839,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
typedef struct MJpegDecodeContext { typedef struct MJpegDecodeContext {
AVCodecContext *avctx; AVCodecContext *avctx;
GetBitContext gb; GetBitContext gb;
int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
int start_code; /* current start code */ int start_code; /* current start code */
int buffer_size; int buffer_size;
...@@ -886,8 +885,7 @@ typedef struct MJpegDecodeContext { ...@@ -886,8 +885,7 @@ typedef struct MJpegDecodeContext {
int8_t *qscale_table; int8_t *qscale_table;
DECLARE_ALIGNED_8(DCTELEM, block[64]); DECLARE_ALIGNED_8(DCTELEM, block[64]);
ScanTable scantable; ScanTable scantable;
void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); DSPContext dsp;
void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
int restart_interval; int restart_interval;
int restart_count; int restart_count;
...@@ -930,23 +928,10 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab ...@@ -930,23 +928,10 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab
static int mjpeg_decode_init(AVCodecContext *avctx) static int mjpeg_decode_init(AVCodecContext *avctx)
{ {
MJpegDecodeContext *s = avctx->priv_data; MJpegDecodeContext *s = avctx->priv_data;
MpegEncContext s2;
memset(s, 0, sizeof(MJpegDecodeContext));
s->avctx = avctx; s->avctx = avctx;
dsputil_init(&s->dsp, avctx);
/* ugly way to get the idct & scantable FIXME */ ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
memset(&s2, 0, sizeof(MpegEncContext));
s2.avctx= avctx;
// s2->out_format = FMT_MJPEG;
dsputil_init(&s2.dsp, avctx);
DCT_common_init(&s2);
s->scantable= s2.intra_scantable;
s->idct_put= s2.dsp.idct_put;
s->idct_add= s2.dsp.idct_add;
s->mpeg_enc_ctx_allocated = 0;
s->buffer_size = 0; s->buffer_size = 0;
s->buffer = NULL; s->buffer = NULL;
s->start_code = -1; s->start_code = -1;
...@@ -1615,9 +1600,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, i ...@@ -1615,9 +1600,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, i
ptr += s->linesize[c] >> 1; ptr += s->linesize[c] >> 1;
//av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8); //av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8);
if(!s->progressive) if(!s->progressive)
s->idct_put(ptr, s->linesize[c], s->block); s->dsp.idct_put(ptr, s->linesize[c], s->block);
else else
s->idct_add(ptr, s->linesize[c], s->block); s->dsp.idct_add(ptr, s->linesize[c], s->block);
if (++x == h) { if (++x == h) {
x = 0; x = 0;
y++; y++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment