changeset 4849:add7658c15ec libavcodec

remove MpegEncContext, patch by baptiste approved by me already but apparently forgotten
author michael
date Sat, 14 Apr 2007 18:42:50 +0000
parents 1e7f86b4e34c
children 9e471439d2e8
files mjpeg.c
diffstat 1 files changed, 5 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mjpeg.c	Sat Apr 14 09:59:57 2007 +0000
+++ b/mjpeg.c	Sat Apr 14 18:42:50 2007 +0000
@@ -839,7 +839,6 @@
 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 @@
     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 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 @@
                         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++;