Revision 1106e4ab libavcodec/mjpeg.c

View differences:

libavcodec/mjpeg.c
839 839
typedef struct MJpegDecodeContext {
840 840
    AVCodecContext *avctx;
841 841
    GetBitContext gb;
842
    int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
843 842

  
844 843
    int start_code; /* current start code */
845 844
    int buffer_size;
......
886 885
    int8_t *qscale_table;
887 886
    DECLARE_ALIGNED_8(DCTELEM, block[64]);
888 887
    ScanTable scantable;
889
    void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
890
    void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
888
    DSPContext dsp;
891 889

  
892 890
    int restart_interval;
893 891
    int restart_count;
......
930 928
static int mjpeg_decode_init(AVCodecContext *avctx)
931 929
{
932 930
    MJpegDecodeContext *s = avctx->priv_data;
933
    MpegEncContext s2;
934
    memset(s, 0, sizeof(MJpegDecodeContext));
935 931

  
936 932
    s->avctx = avctx;
937

  
938
    /* ugly way to get the idct & scantable FIXME */
939
    memset(&s2, 0, sizeof(MpegEncContext));
940
    s2.avctx= avctx;
941
//    s2->out_format = FMT_MJPEG;
942
    dsputil_init(&s2.dsp, avctx);
943
    DCT_common_init(&s2);
944

  
945
    s->scantable= s2.intra_scantable;
946
    s->idct_put= s2.dsp.idct_put;
947
    s->idct_add= s2.dsp.idct_add;
948

  
949
    s->mpeg_enc_ctx_allocated = 0;
933
    dsputil_init(&s->dsp, avctx);
934
    ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
950 935
    s->buffer_size = 0;
951 936
    s->buffer = NULL;
952 937
    s->start_code = -1;
......
1615 1600
                        ptr += s->linesize[c] >> 1;
1616 1601
//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);
1617 1602
                    if(!s->progressive)
1618
                        s->idct_put(ptr, s->linesize[c], s->block);
1603
                        s->dsp.idct_put(ptr, s->linesize[c], s->block);
1619 1604
                    else
1620
                        s->idct_add(ptr, s->linesize[c], s->block);
1605
                        s->dsp.idct_add(ptr, s->linesize[c], s->block);
1621 1606
                    if (++x == h) {
1622 1607
                        x = 0;
1623 1608
                        y++;

Also available in: Unified diff