comparison h263.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 f75be04312dc
children 68e959302527
comparison
equal deleted inserted replaced
8589:a29b5b5c3c9d 8590:7a463923ecd1
52 #define MB_TYPE_B_VLC_BITS 4 52 #define MB_TYPE_B_VLC_BITS 4
53 #define TEX_VLC_BITS 9 53 #define TEX_VLC_BITS 9
54 #define H263_MBTYPE_B_VLC_BITS 6 54 #define H263_MBTYPE_B_VLC_BITS 6
55 #define CBPC_B_VLC_BITS 3 55 #define CBPC_B_VLC_BITS 3
56 56
57 #ifdef CONFIG_ENCODERS 57 #if CONFIG_ENCODERS
58 static void h263_encode_block(MpegEncContext * s, DCTELEM * block, 58 static void h263_encode_block(MpegEncContext * s, DCTELEM * block,
59 int n); 59 int n);
60 static void h263p_encode_umotion(MpegEncContext * s, int val); 60 static void h263p_encode_umotion(MpegEncContext * s, int val);
61 static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, 61 static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block,
62 int n, int dc, uint8_t *scan_table, 62 int n, int dc, uint8_t *scan_table,
70 static int h263_decode_block(MpegEncContext * s, DCTELEM * block, 70 static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
71 int n, int coded); 71 int n, int coded);
72 static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); 72 static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
73 static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, 73 static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
74 int n, int coded, int intra, int rvlc); 74 int n, int coded, int intra, int rvlc);
75 #ifdef CONFIG_ENCODERS 75 #if CONFIG_ENCODERS
76 static int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr); 76 static int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr);
77 static void mpeg4_encode_visual_object_header(MpegEncContext * s); 77 static void mpeg4_encode_visual_object_header(MpegEncContext * s);
78 static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number); 78 static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number);
79 #endif //CONFIG_ENCODERS 79 #endif //CONFIG_ENCODERS
80 static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb); 80 static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb);
81 static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *dir_ptr, int encoding); 81 static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *dir_ptr, int encoding);
82 82
83 #ifdef CONFIG_ENCODERS 83 #if CONFIG_ENCODERS
84 static uint8_t uni_DCtab_lum_len[512]; 84 static uint8_t uni_DCtab_lum_len[512];
85 static uint8_t uni_DCtab_chrom_len[512]; 85 static uint8_t uni_DCtab_chrom_len[512];
86 static uint16_t uni_DCtab_lum_bits[512]; 86 static uint16_t uni_DCtab_lum_bits[512];
87 static uint16_t uni_DCtab_chrom_bits[512]; 87 static uint16_t uni_DCtab_chrom_bits[512];
88 88
153 s->h263_slice_structured ? " SS" : "", 153 s->h263_slice_structured ? " SS" : "",
154 s->avctx->time_base.den, s->avctx->time_base.num 154 s->avctx->time_base.den, s->avctx->time_base.num
155 ); 155 );
156 } 156 }
157 157
158 #ifdef CONFIG_ENCODERS 158 #if CONFIG_ENCODERS
159 159
160 static void aspect_to_info(MpegEncContext * s, AVRational aspect){ 160 static void aspect_to_info(MpegEncContext * s, AVRational aspect){
161 int i; 161 int i;
162 162
163 if(aspect.num==0) aspect= (AVRational){1,1}; 163 if(aspect.num==0) aspect= (AVRational){1,1};
734 else 734 else
735 s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_16x16; 735 s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_16x16;
736 } 736 }
737 } 737 }
738 738
739 #ifdef CONFIG_ENCODERS 739 #if CONFIG_ENCODERS
740 740
741 static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){ 741 static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){
742 int l, bit_size, code; 742 int l, bit_size, code;
743 743
744 if (val == 0) { 744 if (val == 0) {
1547 } 1547 }
1548 } 1548 }
1549 } 1549 }
1550 } 1550 }
1551 1551
1552 #ifdef CONFIG_ENCODERS 1552 #if CONFIG_ENCODERS
1553 static int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr) 1553 static int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr)
1554 { 1554 {
1555 int x, y, wrap, a, c, pred_dc, scale; 1555 int x, y, wrap, a, c, pred_dc, scale;
1556 int16_t *dc_val; 1556 int16_t *dc_val;
1557 1557
1739 *py = mid_pred(A[1], B[1], C[1]); 1739 *py = mid_pred(A[1], B[1], C[1]);
1740 } 1740 }
1741 return *mot_val; 1741 return *mot_val;
1742 } 1742 }
1743 1743
1744 #ifdef CONFIG_ENCODERS 1744 #if CONFIG_ENCODERS
1745 void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code) 1745 void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
1746 { 1746 {
1747 int range, l, bit_size, sign, code, bits; 1747 int range, l, bit_size, sign, code, bits;
1748 1748
1749 if (val == 0) { 1749 if (val == 0) {
2650 for(i=1;i<8;i++) 2650 for(i=1;i<8;i++)
2651 ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]]; 2651 ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]];
2652 2652
2653 } 2653 }
2654 2654
2655 #ifdef CONFIG_ENCODERS 2655 #if CONFIG_ENCODERS
2656 2656
2657 /** 2657 /**
2658 * encodes the dc value. 2658 * encodes the dc value.
2659 * @param n block index (0-3 are luma, 4-5 are chroma) 2659 * @param n block index (0-3 are luma, 4-5 are chroma)
2660 */ 2660 */
3047 int i; 3047 int i;
3048 for(i=0;i<n;i++) 3048 for(i=0;i<n;i++)
3049 tab[i] = val; 3049 tab[i] = val;
3050 } 3050 }
3051 3051
3052 #ifdef CONFIG_ENCODERS 3052 #if CONFIG_ENCODERS
3053 3053
3054 void ff_mpeg4_init_partitions(MpegEncContext *s) 3054 void ff_mpeg4_init_partitions(MpegEncContext *s)
3055 { 3055 {
3056 uint8_t *start= pbBufPtr(&s->pb); 3056 uint8_t *start= pbBufPtr(&s->pb);
3057 uint8_t *end= s->pb.buf_end; 3057 uint8_t *end= s->pb.buf_end;
3104 default: 3104 default:
3105 return -1; 3105 return -1;
3106 } 3106 }
3107 } 3107 }
3108 3108
3109 #ifdef CONFIG_ENCODERS 3109 #if CONFIG_ENCODERS
3110 3110
3111 void ff_mpeg4_encode_video_packet_header(MpegEncContext *s) 3111 void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
3112 { 3112 {
3113 int mb_num_bits= av_log2(s->mb_num - 1) + 1; 3113 int mb_num_bits= av_log2(s->mb_num - 1) + 1;
3114 3114
4561 scan_table = s->intra_h_scantable.permutated; /* top */ 4561 scan_table = s->intra_h_scantable.permutated; /* top */
4562 } 4562 }
4563 } else if (s->mb_intra) { 4563 } else if (s->mb_intra) {
4564 /* DC coef */ 4564 /* DC coef */
4565 if(s->codec_id == CODEC_ID_RV10){ 4565 if(s->codec_id == CODEC_ID_RV10){
4566 #ifdef CONFIG_RV10_DECODER 4566 #if CONFIG_RV10_DECODER
4567 if (s->rv10_version == 3 && s->pict_type == FF_I_TYPE) { 4567 if (s->rv10_version == 3 && s->pict_type == FF_I_TYPE) {
4568 int component, diff; 4568 int component, diff;
4569 component = (n <= 3 ? 0 : n - 4 + 1); 4569 component = (n <= 3 ? 0 : n - 4 + 1);
4570 level = s->last_dc[component]; 4570 level = s->last_dc[component];
4571 if (s->rv10_first_dc_coded[component]) { 4571 if (s->rv10_first_dc_coded[component]) {