aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpeg.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@smartjog.com>2007-04-14 18:42:50 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-04-14 18:42:50 +0000
commit1106e4abe4ee7acfd62315c004cd0f3ce603f9b1 (patch)
treee7e59857df84e6273c0f12a45dcb0fdffb62e6ba /libavcodec/mjpeg.c
parent859d95baa16a38d8b56e1c949effea870ee30d3b (diff)
downloadffmpeg-1106e4abe4ee7acfd62315c004cd0f3ce603f9b1.tar.gz
remove MpegEncContext, patch by baptiste
approved by me already but apparently forgotten Originally committed as revision 8733 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpeg.c')
-rw-r--r--libavcodec/mjpeg.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index e3583e54e0..7f443954be 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -839,7 +839,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
typedef struct MJpegDecodeContext {
AVCodecContext *avctx;
GetBitContext gb;
- int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
int start_code; /* current start code */
int buffer_size;
@@ -886,8 +885,7 @@ typedef struct MJpegDecodeContext {
int8_t *qscale_table;
DECLARE_ALIGNED_8(DCTELEM, block[64]);
ScanTable scantable;
- void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
- void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
+ DSPContext dsp;
int restart_interval;
int restart_count;
@@ -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)
{
MJpegDecodeContext *s = avctx->priv_data;
- MpegEncContext s2;
- memset(s, 0, sizeof(MJpegDecodeContext));
s->avctx = avctx;
-
- /* ugly way to get the idct & scantable FIXME */
- 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;
+ dsputil_init(&s->dsp, avctx);
+ ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
s->buffer_size = 0;
s->buffer = NULL;
s->start_code = -1;
@@ -1615,9 +1600,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, i
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);
if(!s->progressive)
- s->idct_put(ptr, s->linesize[c], s->block);
+ s->dsp.idct_put(ptr, s->linesize[c], s->block);
else
- s->idct_add(ptr, s->linesize[c], s->block);
+ s->dsp.idct_add(ptr, s->linesize[c], s->block);
if (++x == h) {
x = 0;
y++;