comparison pcm.c @ 6517:48759bfbd073 libavcodec

Apply 'cold' attribute to init/uninit functions in libavcodec
author zuxy
date Fri, 21 Mar 2008 03:11:20 +0000
parents dfdff1ca78a7
children 0557f6cc5ed0
comparison
equal deleted inserted replaced
6516:dbb902bb2347 6517:48759bfbd073
42 42
43 /* 43 /*
44 * alaw2linear() - Convert an A-law value to 16-bit linear PCM 44 * alaw2linear() - Convert an A-law value to 16-bit linear PCM
45 * 45 *
46 */ 46 */
47 static int alaw2linear(unsigned char a_val) 47 static av_cold int alaw2linear(unsigned char a_val)
48 { 48 {
49 int t; 49 int t;
50 int seg; 50 int seg;
51 51
52 a_val ^= 0x55; 52 a_val ^= 0x55;
57 else t= (t + t + 1 ) << 3; 57 else t= (t + t + 1 ) << 3;
58 58
59 return ((a_val & SIGN_BIT) ? t : -t); 59 return ((a_val & SIGN_BIT) ? t : -t);
60 } 60 }
61 61
62 static int ulaw2linear(unsigned char u_val) 62 static av_cold int ulaw2linear(unsigned char u_val)
63 { 63 {
64 int t; 64 int t;
65 65
66 /* Complement to obtain normal u-law value. */ 66 /* Complement to obtain normal u-law value. */
67 u_val = ~u_val; 67 u_val = ~u_val;
78 78
79 /* 16384 entries per table */ 79 /* 16384 entries per table */
80 static uint8_t linear_to_alaw[16384]; 80 static uint8_t linear_to_alaw[16384];
81 static uint8_t linear_to_ulaw[16384]; 81 static uint8_t linear_to_ulaw[16384];
82 82
83 static void build_xlaw_table(uint8_t *linear_to_xlaw, 83 static av_cold void build_xlaw_table(uint8_t *linear_to_xlaw,
84 int (*xlaw2linear)(unsigned char), 84 int (*xlaw2linear)(unsigned char),
85 int mask) 85 int mask)
86 { 86 {
87 int i, j, v, v1, v2; 87 int i, j, v, v1, v2;
88 88
102 } 102 }
103 } 103 }
104 linear_to_xlaw[0] = linear_to_xlaw[1]; 104 linear_to_xlaw[0] = linear_to_xlaw[1];
105 } 105 }
106 106
107 static int pcm_encode_init(AVCodecContext *avctx) 107 static av_cold int pcm_encode_init(AVCodecContext *avctx)
108 { 108 {
109 avctx->frame_size = 1; 109 avctx->frame_size = 1;
110 switch(avctx->codec->id) { 110 switch(avctx->codec->id) {
111 case CODEC_ID_PCM_ALAW: 111 case CODEC_ID_PCM_ALAW:
112 build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); 112 build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
152 avctx->coded_frame->key_frame= 1; 152 avctx->coded_frame->key_frame= 1;
153 153
154 return 0; 154 return 0;
155 } 155 }
156 156
157 static int pcm_encode_close(AVCodecContext *avctx) 157 static av_cold int pcm_encode_close(AVCodecContext *avctx)
158 { 158 {
159 av_freep(&avctx->coded_frame); 159 av_freep(&avctx->coded_frame);
160 160
161 return 0; 161 return 0;
162 } 162 }
323 323
324 typedef struct PCMDecode { 324 typedef struct PCMDecode {
325 short table[256]; 325 short table[256];
326 } PCMDecode; 326 } PCMDecode;
327 327
328 static int pcm_decode_init(AVCodecContext * avctx) 328 static av_cold int pcm_decode_init(AVCodecContext * avctx)
329 { 329 {
330 PCMDecode *s = avctx->priv_data; 330 PCMDecode *s = avctx->priv_data;
331 int i; 331 int i;
332 332
333 switch(avctx->codec->id) { 333 switch(avctx->codec->id) {