moved dct init out from mpv_common_init to dct_common_init (for less-uglier way for dv)

Originally committed as revision 1002 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Alex Beregszaszi 23 years ago
parent 1e5c667c91
commit defdfc9aa0
  1. 10
      libavcodec/dv.c
  2. 19
      libavcodec/mpegvideo.c
  3. 1
      libavcodec/mpegvideo.h

@ -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
};

@ -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;

@ -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]);

Loading…
Cancel
Save