changeset 726:a91203b34e71 libavcodec

moved dct init out from mpv_common_init to dct_common_init (for less-uglier way for dv)
author al3x
date Fri, 04 Oct 2002 20:59:29 +0000
parents eac6c71ef30f
children c816782e3161
files dv.c mpegvideo.c mpegvideo.h
diffstat 3 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dv.c	Fri Oct 04 07:49:00 2002 +0000
+++ b/dv.c	Fri Oct 04 20:59:29 2002 +0000
@@ -113,12 +113,8 @@
     /* 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 @@
     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 @@
 } BlockInfo;
 
 /* block size in bits */
-const static UINT16 block_sizes[6] = {
+static const UINT16 block_sizes[6] = {
     112, 112, 112, 112, 80, 80
 };
 
--- a/mpegvideo.c	Fri Oct 04 07:49:00 2002 +0000
+++ b/mpegvideo.c	Fri Oct 04 20:59:29 2002 +0000
@@ -179,11 +179,10 @@
     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 @@
 #ifdef HAVE_MMI
     MPV_common_init_mmi(s);
 #endif
-    
 
     /* load & permutate scantables
        note: only wmv uses differnt ones 
@@ -229,6 +227,17 @@
     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;
     
--- a/mpegvideo.h	Fri Oct 04 07:49:00 2002 +0000
+++ b/mpegvideo.h	Fri Oct 04 20:59:29 2002 +0000
@@ -489,6 +489,7 @@
     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]);