Browse code

split wmv2 in its own file

Originally committed as revision 10951 to svn://svn.ffmpeg.org/ffmpeg/trunk

Aurelien Jacobs authored on 2007/11/08 08:41:39
Showing 4 changed files
... ...
@@ -209,8 +209,8 @@ OBJS-$(CONFIG_WMAV1_ENCODER)           += wmaenc.o wma.o mdct.o fft.o
209 209
 OBJS-$(CONFIG_WMAV2_ENCODER)           += wmaenc.o wma.o mdct.o fft.o
210 210
 OBJS-$(CONFIG_WMV1_DECODER)            += h263dec.o h263.o
211 211
 OBJS-$(CONFIG_WMV1_ENCODER)            += mpegvideo_enc.o motion_est.o ratecontrol.o h263.o
212
-OBJS-$(CONFIG_WMV2_DECODER)            += msmpeg4.o msmpeg4data.o h263dec.o h263.o
213
-OBJS-$(CONFIG_WMV2_ENCODER)            += msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o
212
+OBJS-$(CONFIG_WMV2_DECODER)            += wmv2.o msmpeg4.o msmpeg4data.o h263dec.o h263.o
213
+OBJS-$(CONFIG_WMV2_ENCODER)            += wmv2.o msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o
214 214
 OBJS-$(CONFIG_WMV3_DECODER)            += vc1.o vc1data.o vc1dsp.o
215 215
 OBJS-$(CONFIG_WNV1_DECODER)            += wnv1.o
216 216
 OBJS-$(CONFIG_WS_SND1_DECODER)         += ws-snd1.o
... ...
@@ -30,6 +30,7 @@
30 30
 #include "avcodec.h"
31 31
 #include "dsputil.h"
32 32
 #include "mpegvideo.h"
33
+#include "msmpeg4.h"
33 34
 
34 35
 /*
35 36
  * You can also call this codec : MPEG4 with a twist !
... ...
@@ -42,7 +43,6 @@
42 42
 
43 43
 #define DC_VLC_BITS 9
44 44
 #define CBPY_VLC_BITS 6
45
-#define INTER_INTRA_VLC_BITS 3
46 45
 #define V1_INTRA_CBPC_VLC_BITS 6
47 46
 #define V1_INTER_CBPC_VLC_BITS 6
48 47
 #define V2_INTRA_CBPC_VLC_BITS 3
... ...
@@ -50,8 +50,6 @@
50 50
 #define MV_VLC_BITS 9
51 51
 #define V2_MV_VLC_BITS 9
52 52
 #define TEX_VLC_BITS 9
53
-#define MB_NON_INTRA_VLC_BITS 9
54
-#define MB_INTRA_VLC_BITS 9
55 53
 
56 54
 #define II_BITRATE 128*1024
57 55
 #define MBAC_BITRATE 50*1024
... ...
@@ -61,12 +59,7 @@
61 61
 static uint32_t v2_dc_lum_table[512][2];
62 62
 static uint32_t v2_dc_chroma_table[512][2];
63 63
 
64
-void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
65
-int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
66
-                                       int n, int coded, const uint8_t *scantable);
67 64
 static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
68
-int ff_msmpeg4_decode_motion(MpegEncContext * s,
69
-                                 int *mx_ptr, int *my_ptr);
70 65
 static void init_h263_dc_for_msmpeg4(void);
71 66
 static inline void msmpeg4_memsetw(short *tab, int val, int n);
72 67
 #ifdef CONFIG_ENCODERS
... ...
@@ -75,7 +68,6 @@ static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run,
75 75
 #endif //CONFIG_ENCODERS
76 76
 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
77 77
 static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
78
-int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
79 78
 
80 79
 /* vc1 externs */
81 80
 extern uint8_t wmv3_dc_scale_table[32];
... ...
@@ -1145,6 +1137,7 @@ int ff_msmpeg4_decode_init(MpegEncContext *s)
1145 1145
         s->decode_mb= msmpeg4v34_decode_mb;
1146 1146
         break;
1147 1147
     case 5:
1148
+        if (ENABLE_WMV2_DECODER)
1148 1149
         s->decode_mb= ff_wmv2_decode_mb;
1149 1150
     case 6:
1150 1151
         //FIXME + TODO VC1 decode mb
... ...
@@ -1949,9 +1942,3 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
1949 1949
     *my_ptr = my;
1950 1950
     return 0;
1951 1951
 }
1952
-
1953
-/* cleanest way to support it
1954
- * there is too much shared between versions so that we cant have 1 file per version & 1 common
1955
- * as allmost everything would be in the common file
1956
- */
1957
-#include "wmv2.c"
... ...
@@ -27,6 +27,27 @@
27 27
 #define FFMPEG_MSMPEG4_H
28 28
 
29 29
 #include "config.h"
30
+#include "avcodec.h"
31
+#include "dsputil.h"
32
+#include "mpegvideo.h"
33
+
34
+#define INTER_INTRA_VLC_BITS 3
35
+#define MB_NON_INTRA_VLC_BITS 9
36
+#define MB_INTRA_VLC_BITS 9
37
+
38
+extern VLC ff_mb_non_intra_vlc[4];
39
+extern VLC ff_inter_intra_vlc;
40
+
41
+void ff_msmpeg4_code012(PutBitContext *pb, int n);
42
+void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
43
+void ff_msmpeg4_handle_slices(MpegEncContext *s);
44
+void ff_msmpeg4_encode_motion(MpegEncContext * s, int mx, int my);
45
+int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n,
46
+                                uint8_t **coded_block_ptr);
47
+int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr);
48
+int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
49
+                            int n, int coded, const uint8_t *scan_table);
50
+int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
30 51
 
31 52
 #define ENABLE_MSMPEG4_DECODER (ENABLE_MSMPEG4V1_DECODER || \
32 53
                                 ENABLE_MSMPEG4V2_DECODER || \
... ...
@@ -23,6 +23,11 @@
23 23
  * wmv2 codec.
24 24
  */
25 25
 
26
+#include "avcodec.h"
27
+#include "dsputil.h"
28
+#include "mpegvideo.h"
29
+#include "msmpeg4.h"
30
+#include "msmpeg4data.h"
26 31
 #include "simple_idct.h"
27 32
 
28 33
 #define SKIP_TYPE_NONE 0