Mercurial > libavcodec.hg
comparison msmpeg4.c @ 5884:02007962faf4 libavcodec
split wmv2 in its own file
author | aurel |
---|---|
date | Wed, 07 Nov 2007 23:41:39 +0000 |
parents | 51fc10d9fdff |
children | 5c19c955c62b |
comparison
equal
deleted
inserted
replaced
5883:c64d94561b19 | 5884:02007962faf4 |
---|---|
28 */ | 28 */ |
29 | 29 |
30 #include "avcodec.h" | 30 #include "avcodec.h" |
31 #include "dsputil.h" | 31 #include "dsputil.h" |
32 #include "mpegvideo.h" | 32 #include "mpegvideo.h" |
33 #include "msmpeg4.h" | |
33 | 34 |
34 /* | 35 /* |
35 * You can also call this codec : MPEG4 with a twist ! | 36 * You can also call this codec : MPEG4 with a twist ! |
36 * | 37 * |
37 * TODO: | 38 * TODO: |
40 */ | 41 */ |
41 //#define DEBUG | 42 //#define DEBUG |
42 | 43 |
43 #define DC_VLC_BITS 9 | 44 #define DC_VLC_BITS 9 |
44 #define CBPY_VLC_BITS 6 | 45 #define CBPY_VLC_BITS 6 |
45 #define INTER_INTRA_VLC_BITS 3 | |
46 #define V1_INTRA_CBPC_VLC_BITS 6 | 46 #define V1_INTRA_CBPC_VLC_BITS 6 |
47 #define V1_INTER_CBPC_VLC_BITS 6 | 47 #define V1_INTER_CBPC_VLC_BITS 6 |
48 #define V2_INTRA_CBPC_VLC_BITS 3 | 48 #define V2_INTRA_CBPC_VLC_BITS 3 |
49 #define V2_MB_TYPE_VLC_BITS 7 | 49 #define V2_MB_TYPE_VLC_BITS 7 |
50 #define MV_VLC_BITS 9 | 50 #define MV_VLC_BITS 9 |
51 #define V2_MV_VLC_BITS 9 | 51 #define V2_MV_VLC_BITS 9 |
52 #define TEX_VLC_BITS 9 | 52 #define TEX_VLC_BITS 9 |
53 #define MB_NON_INTRA_VLC_BITS 9 | |
54 #define MB_INTRA_VLC_BITS 9 | |
55 | 53 |
56 #define II_BITRATE 128*1024 | 54 #define II_BITRATE 128*1024 |
57 #define MBAC_BITRATE 50*1024 | 55 #define MBAC_BITRATE 50*1024 |
58 | 56 |
59 #define DEFAULT_INTER_INDEX 3 | 57 #define DEFAULT_INTER_INDEX 3 |
60 | 58 |
61 static uint32_t v2_dc_lum_table[512][2]; | 59 static uint32_t v2_dc_lum_table[512][2]; |
62 static uint32_t v2_dc_chroma_table[512][2]; | 60 static uint32_t v2_dc_chroma_table[512][2]; |
63 | 61 |
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 static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); | 62 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 static void init_h263_dc_for_msmpeg4(void); | 63 static void init_h263_dc_for_msmpeg4(void); |
71 static inline void msmpeg4_memsetw(short *tab, int val, int n); | 64 static inline void msmpeg4_memsetw(short *tab, int val, int n); |
72 #ifdef CONFIG_ENCODERS | 65 #ifdef CONFIG_ENCODERS |
73 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); | 66 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); |
74 static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra); | 67 static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra); |
75 #endif //CONFIG_ENCODERS | 68 #endif //CONFIG_ENCODERS |
76 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); | 69 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); |
77 static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); | 70 static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); |
78 int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); | |
79 | 71 |
80 /* vc1 externs */ | 72 /* vc1 externs */ |
81 extern uint8_t wmv3_dc_scale_table[32]; | 73 extern uint8_t wmv3_dc_scale_table[32]; |
82 | 74 |
83 #ifdef DEBUG | 75 #ifdef DEBUG |
1143 case 3: | 1135 case 3: |
1144 case 4: | 1136 case 4: |
1145 s->decode_mb= msmpeg4v34_decode_mb; | 1137 s->decode_mb= msmpeg4v34_decode_mb; |
1146 break; | 1138 break; |
1147 case 5: | 1139 case 5: |
1140 if (ENABLE_WMV2_DECODER) | |
1148 s->decode_mb= ff_wmv2_decode_mb; | 1141 s->decode_mb= ff_wmv2_decode_mb; |
1149 case 6: | 1142 case 6: |
1150 //FIXME + TODO VC1 decode mb | 1143 //FIXME + TODO VC1 decode mb |
1151 break; | 1144 break; |
1152 } | 1145 } |
1947 my -= 64; | 1940 my -= 64; |
1948 *mx_ptr = mx; | 1941 *mx_ptr = mx; |
1949 *my_ptr = my; | 1942 *my_ptr = my; |
1950 return 0; | 1943 return 0; |
1951 } | 1944 } |
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" |