diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 3ab693c5bd..02478cae36 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -113,12 +113,8 @@ static int dvvideo_decode_init(AVCodecContext *avctx) /* ugly way to get the idct & scantable */ /* XXX: fix it */ memset(&s2, 0, sizeof(MpegEncContext)); - s2.flags = avctx->flags; s2.avctx = avctx; -// s2->out_format = FMT_MJPEG; - s2.width = 8; - s2.height = 8; - if (MPV_common_init(&s2) < 0) + if (DCT_common_init(&s2) < 0) return -1; s->idct_put[0] = s2.idct_put; @@ -129,8 +125,6 @@ static int dvvideo_decode_init(AVCodecContext *avctx) s->idct_put[1] = simple_idct248_put; memcpy(s->dv_zigzag[1], dv_248_zigzag, 64); - MPV_common_end(&s2); - /* XXX: do it only for constant case */ dv_build_unquantize_tables(s); @@ -151,7 +145,7 @@ typedef struct BlockInfo { } BlockInfo; /* block size in bits */ -const static UINT16 block_sizes[6] = { +static const UINT16 block_sizes[6] = { 112, 112, 112, 112, 80, 80 }; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5fd933da7e..229874b921 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -179,11 +179,10 @@ static void ff_jref_idct_add(UINT8 *dest, int line_size, DCTELEM *block) add_pixels_clamped(block, dest, line_size); } -/* init common structure for both encoder and decoder */ -int MPV_common_init(MpegEncContext *s) +/* init common dct for both encoder and decoder */ +int DCT_common_init(MpegEncContext *s) { - int c_size, i; - UINT8 *pict; + int i; s->dct_unquantize_h263 = dct_unquantize_h263_c; s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c; @@ -219,7 +218,6 @@ int MPV_common_init(MpegEncContext *s) #ifdef HAVE_MMI MPV_common_init_mmi(s); #endif - /* load & permutate scantables note: only wmv uses differnt ones @@ -229,6 +227,17 @@ int MPV_common_init(MpegEncContext *s) ff_init_scantable(s, &s->intra_h_scantable, ff_alternate_horizontal_scan); ff_init_scantable(s, &s->intra_v_scantable, ff_alternate_vertical_scan); + return 0; +} + +/* init common structure for both encoder and decoder */ +int MPV_common_init(MpegEncContext *s) +{ + int c_size, i; + UINT8 *pict; + + DCT_common_init(s); + s->mb_width = (s->width + 15) / 16; s->mb_height = (s->height + 15) / 16; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 863e2a0122..dacb08eb69 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -489,6 +489,7 @@ typedef struct MpegEncContext { void (*idct_add)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); } MpegEncContext; +int DCT_common_init(MpegEncContext *s); int MPV_common_init(MpegEncContext *s); void MPV_common_end(MpegEncContext *s); void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);