Mercurial > libavcodec.hg
comparison msmpeg4.c @ 8590:7a463923ecd1 libavcodec
Change semantic of CONFIG_*, HAVE_* and ARCH_*.
They are now always defined to either 0 or 1.
author | aurel |
---|---|
date | Tue, 13 Jan 2009 23:44:16 +0000 |
parents | eebc7209c47f |
children | 68e959302527 |
comparison
equal
deleted
inserted
replaced
8589:a29b5b5c3c9d | 8590:7a463923ecd1 |
---|---|
60 static uint32_t v2_dc_chroma_table[512][2]; | 60 static uint32_t v2_dc_chroma_table[512][2]; |
61 | 61 |
62 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); |
63 static void init_h263_dc_for_msmpeg4(void); | 63 static void init_h263_dc_for_msmpeg4(void); |
64 static inline void msmpeg4_memsetw(short *tab, int val, int n); | 64 static inline void msmpeg4_memsetw(short *tab, int val, int n); |
65 #ifdef CONFIG_ENCODERS | 65 #if CONFIG_ENCODERS |
66 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); | 66 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); |
67 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); |
68 #endif //CONFIG_ENCODERS | 68 #endif //CONFIG_ENCODERS |
69 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); | 69 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); |
70 static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); | 70 static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); |
77 int frame_count = 0; | 77 int frame_count = 0; |
78 #endif | 78 #endif |
79 | 79 |
80 #include "msmpeg4data.h" | 80 #include "msmpeg4data.h" |
81 | 81 |
82 #ifdef CONFIG_ENCODERS //strangely gcc includes this even if it is not references | 82 #if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced |
83 static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; | 83 static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; |
84 #endif //CONFIG_ENCODERS | 84 #endif //CONFIG_ENCODERS |
85 | 85 |
86 static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3]; | 86 static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3]; |
87 | 87 |
107 case 4: | 107 case 4: |
108 case 5: | 108 case 5: |
109 s->y_dc_scale_table= wmv1_y_dc_scale_table; | 109 s->y_dc_scale_table= wmv1_y_dc_scale_table; |
110 s->c_dc_scale_table= wmv1_c_dc_scale_table; | 110 s->c_dc_scale_table= wmv1_c_dc_scale_table; |
111 break; | 111 break; |
112 #if defined(CONFIG_WMV3_DECODER)||defined(CONFIG_VC1_DECODER) | 112 #if CONFIG_WMV3_DECODER || CONFIG_VC1_DECODER |
113 case 6: | 113 case 6: |
114 s->y_dc_scale_table= wmv3_dc_scale_table; | 114 s->y_dc_scale_table= wmv3_dc_scale_table; |
115 s->c_dc_scale_table= wmv3_dc_scale_table; | 115 s->c_dc_scale_table= wmv3_dc_scale_table; |
116 break; | 116 break; |
117 #endif | 117 #endif |
132 | 132 |
133 init_h263_dc_for_msmpeg4(); | 133 init_h263_dc_for_msmpeg4(); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 #ifdef CONFIG_ENCODERS | 137 #if CONFIG_ENCODERS |
138 | 138 |
139 /* build the table which associate a (x,y) motion vector to a vlc */ | 139 /* build the table which associate a (x,y) motion vector to a vlc */ |
140 static void init_mv_table(MVTable *tab) | 140 static void init_mv_table(MVTable *tab) |
141 { | 141 { |
142 int i, x, y; | 142 int i, x, y; |
409 *coded_block_ptr = &s->coded_block[xy]; | 409 *coded_block_ptr = &s->coded_block[xy]; |
410 | 410 |
411 return pred; | 411 return pred; |
412 } | 412 } |
413 | 413 |
414 #ifdef CONFIG_ENCODERS | 414 #if CONFIG_ENCODERS |
415 | 415 |
416 void ff_msmpeg4_encode_motion(MpegEncContext * s, | 416 void ff_msmpeg4_encode_motion(MpegEncContext * s, |
417 int mx, int my) | 417 int mx, int my) |
418 { | 418 { |
419 int code; | 419 int code; |
651 | 651 |
652 /* XXX: the following solution consumes divisions, but it does not | 652 /* XXX: the following solution consumes divisions, but it does not |
653 necessitate to modify mpegvideo.c. The problem comes from the | 653 necessitate to modify mpegvideo.c. The problem comes from the |
654 fact they decided to store the quantized DC (which would lead | 654 fact they decided to store the quantized DC (which would lead |
655 to problems if Q could vary !) */ | 655 to problems if Q could vary !) */ |
656 #if (defined(ARCH_X86)) && !defined PIC | 656 #if ARCH_X86 && !defined PIC |
657 __asm__ volatile( | 657 __asm__ volatile( |
658 "movl %3, %%eax \n\t" | 658 "movl %3, %%eax \n\t" |
659 "shrl $1, %%eax \n\t" | 659 "shrl $1, %%eax \n\t" |
660 "addl %%eax, %2 \n\t" | 660 "addl %%eax, %2 \n\t" |
661 "addl %%eax, %1 \n\t" | 661 "addl %%eax, %1 \n\t" |
671 : "+b" (a), "+c" (b), "+D" (c) | 671 : "+b" (a), "+c" (b), "+D" (c) |
672 : "g" (scale), "S" (ff_inverse[scale]) | 672 : "g" (scale), "S" (ff_inverse[scale]) |
673 : "%eax", "%edx" | 673 : "%eax", "%edx" |
674 ); | 674 ); |
675 #else | 675 #else |
676 /* #elif defined (ARCH_ALPHA) */ | 676 /* #elif ARCH_ALPHA */ |
677 /* Divisions are extremely costly on Alpha; optimize the most | 677 /* Divisions are extremely costly on Alpha; optimize the most |
678 common case. But they are costly everywhere... | 678 common case. But they are costly everywhere... |
679 */ | 679 */ |
680 if (scale == 8) { | 680 if (scale == 8) { |
681 a = (a + (8 >> 1)) / 8; | 681 a = (a + (8 >> 1)) / 8; |
1360 int i; | 1360 int i; |
1361 for(i=0;i<n;i++) | 1361 for(i=0;i<n;i++) |
1362 tab[i] = val; | 1362 tab[i] = val; |
1363 } | 1363 } |
1364 | 1364 |
1365 #ifdef CONFIG_ENCODERS | 1365 #if CONFIG_ENCODERS |
1366 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val) | 1366 static void msmpeg4v2_encode_motion(MpegEncContext * s, int val) |
1367 { | 1367 { |
1368 int range, bit_size, sign, code, bits; | 1368 int range, bit_size, sign, code, bits; |
1369 | 1369 |
1370 if (val == 0) { | 1370 if (val == 0) { |