Browse code

cosmetics: rename ac3 tables

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

Justin Ruggles authored on 2007/12/09 12:21:33
Showing 6 changed files
... ...
@@ -72,7 +72,7 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
72 72
         for(i=j;i<end1;i++) {
73 73
             /* logadd */
74 74
             int adr = FFMIN(FFABS(v - psd[j]) >> 1, 255);
75
-            v = FFMAX(v, psd[j]) + ff_ac3_latab[adr];
75
+            v = FFMAX(v, psd[j]) + ff_ac3_log_add_tab[adr];
76 76
             j++;
77 77
         }
78 78
         bndpsd[k]=v;
... ...
@@ -149,7 +149,7 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *bndpsd,
149 149
         if (tmp > 0) {
150 150
             excite[bin] += tmp >> 2;
151 151
         }
152
-        mask[bin] = FFMAX(ff_ac3_hth[bin >> s->halfratecod][s->fscod], excite[bin]);
152
+        mask[bin] = FFMAX(ff_ac3_hearing_threshold_tab[bin >> s->halfratecod][s->fscod], excite[bin]);
153 153
     }
154 154
 
155 155
     /* delta bit allocation */
... ...
@@ -187,10 +187,10 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
187 187
     j = masktab[start];
188 188
     do {
189 189
         v = (FFMAX(mask[j] - snroffset - floor, 0) & 0x1FE0) + floor;
190
-        end1 = FFMIN(bndtab[j] + ff_ac3_bndsz[j], end);
190
+        end1 = FFMIN(bndtab[j] + ff_ac3_critical_band_size_tab[j], end);
191 191
         for (k = i; k < end1; k++) {
192 192
             address = av_clip((psd[i] - v) >> 5, 0, 63);
193
-            bap[i] = ff_ac3_baptab[address];
193
+            bap[i] = ff_ac3_bap_tab[address];
194 194
             i++;
195 195
         }
196 196
     } while (end > bndtab[j++]);
... ...
@@ -231,7 +231,7 @@ void ac3_common_init(void)
231 231
     l = 0;
232 232
     for(i=0;i<50;i++) {
233 233
         bndtab[i] = l;
234
-        v = ff_ac3_bndsz[i];
234
+        v = ff_ac3_critical_band_size_tab[i];
235 235
         for(j=0;j<v;j++) masktab[k++]=i;
236 236
         l += v;
237 237
     }
... ...
@@ -76,10 +76,10 @@ int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr)
76 76
     hdr->lfeon = get_bits1(&gbc);
77 77
 
78 78
     hdr->halfratecod = FFMAX(hdr->bsid, 8) - 8;
79
-    hdr->sample_rate = ff_ac3_freqs[hdr->fscod] >> hdr->halfratecod;
80
-    hdr->bit_rate = (ff_ac3_bitratetab[hdr->frmsizecod>>1] * 1000) >> hdr->halfratecod;
81
-    hdr->channels = ff_ac3_channels[hdr->acmod] + hdr->lfeon;
82
-    hdr->frame_size = ff_ac3_frame_sizes[hdr->frmsizecod][hdr->fscod] * 2;
79
+    hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->fscod] >> hdr->halfratecod;
80
+    hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->frmsizecod>>1] * 1000) >> hdr->halfratecod;
81
+    hdr->channels = ff_ac3_channels_tab[hdr->acmod] + hdr->lfeon;
82
+    hdr->frame_size = ff_ac3_frame_size_tab[hdr->frmsizecod][hdr->fscod] * 2;
83 83
 
84 84
     return 0;
85 85
 }
... ...
@@ -125,11 +125,11 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
125 125
             if(fscod2 == 3)
126 126
                 return 0;
127 127
 
128
-            *sample_rate = ff_ac3_freqs[fscod2] / 2;
128
+            *sample_rate = ff_ac3_sample_rate_tab[fscod2] / 2;
129 129
         } else {
130 130
             numblkscod = get_bits(&bits, 2);
131 131
 
132
-            *sample_rate = ff_ac3_freqs[fscod];
132
+            *sample_rate = ff_ac3_sample_rate_tab[fscod];
133 133
         }
134 134
 
135 135
         acmod = get_bits(&bits, 3);
... ...
@@ -137,7 +137,7 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
137 137
 
138 138
         *samples = eac3_blocks[numblkscod] * 256;
139 139
         *bit_rate = frmsiz * (*sample_rate) * 16 / (*samples);
140
-        *channels = ff_ac3_channels[acmod] + lfeon;
140
+        *channels = ff_ac3_channels_tab[acmod] + lfeon;
141 141
 
142 142
         return frmsiz * 2;
143 143
     }
... ...
@@ -947,11 +947,11 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
947 947
 
948 948
     /* bit allocation information */
949 949
     if (get_bits1(gb)) {
950
-        ctx->bit_alloc_params.sdecay = ff_sdecaytab[get_bits(gb, 2)] >> ctx->bit_alloc_params.halfratecod;
951
-        ctx->bit_alloc_params.fdecay = ff_fdecaytab[get_bits(gb, 2)] >> ctx->bit_alloc_params.halfratecod;
952
-        ctx->bit_alloc_params.sgain  = ff_sgaintab[get_bits(gb, 2)];
953
-        ctx->bit_alloc_params.dbknee = ff_dbkneetab[get_bits(gb, 2)];
954
-        ctx->bit_alloc_params.floor  = ff_floortab[get_bits(gb, 3)];
950
+        ctx->bit_alloc_params.sdecay = ff_ac3_slow_decay_tab[get_bits(gb, 2)] >> ctx->bit_alloc_params.halfratecod;
951
+        ctx->bit_alloc_params.fdecay = ff_ac3_fast_decay_tab[get_bits(gb, 2)] >> ctx->bit_alloc_params.halfratecod;
952
+        ctx->bit_alloc_params.sgain  = ff_ac3_slow_gain_tab[get_bits(gb, 2)];
953
+        ctx->bit_alloc_params.dbknee = ff_ac3_db_per_bit_tab[get_bits(gb, 2)];
954
+        ctx->bit_alloc_params.floor  = ff_ac3_floor_tab[get_bits(gb, 3)];
955 955
         for(ch=!ctx->cplinu; ch<=ctx->nchans; ch++) {
956 956
             bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
957 957
         }
... ...
@@ -963,7 +963,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
963 963
         csnr = (get_bits(gb, 6) - 15) << 4;
964 964
         for (ch = !ctx->cplinu; ch <= ctx->nchans; ch++) { /* snr offset and fast gain */
965 965
             ctx->snroffst[ch] = (csnr + get_bits(gb, 4)) << 2;
966
-            ctx->fgain[ch] = ff_fgaintab[get_bits(gb, 3)];
966
+            ctx->fgain[ch] = ff_ac3_fast_gain_tab[get_bits(gb, 3)];
967 967
         }
968 968
         memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
969 969
     }
... ...
@@ -451,7 +451,7 @@ static void bit_alloc_masking(AC3EncodeContext *s,
451 451
                                           psd[blk][ch], bndpsd[blk][ch]);
452 452
                 ff_ac3_bit_alloc_calc_mask(&s->bit_alloc, bndpsd[blk][ch],
453 453
                                            0, s->nb_coefs[ch],
454
-                                           ff_fgaintab[s->fgaincod[ch]],
454
+                                           ff_ac3_fast_gain_tab[s->fgaincod[ch]],
455 455
                                            ch == s->lfe_channel,
456 456
                                            DBA_NONE, 0, NULL, NULL, NULL,
457 457
                                            mask[blk][ch]);
... ...
@@ -519,11 +519,11 @@ static int compute_bit_allocation(AC3EncodeContext *s,
519 519
     /* compute real values */
520 520
     s->bit_alloc.fscod = s->fscod;
521 521
     s->bit_alloc.halfratecod = s->halfratecod;
522
-    s->bit_alloc.sdecay = ff_sdecaytab[s->sdecaycod] >> s->halfratecod;
523
-    s->bit_alloc.fdecay = ff_fdecaytab[s->fdecaycod] >> s->halfratecod;
524
-    s->bit_alloc.sgain = ff_sgaintab[s->sgaincod];
525
-    s->bit_alloc.dbknee = ff_dbkneetab[s->dbkneecod];
526
-    s->bit_alloc.floor = ff_floortab[s->floorcod];
522
+    s->bit_alloc.sdecay = ff_ac3_slow_decay_tab[s->sdecaycod] >> s->halfratecod;
523
+    s->bit_alloc.fdecay = ff_ac3_fast_decay_tab[s->fdecaycod] >> s->halfratecod;
524
+    s->bit_alloc.sgain = ff_ac3_slow_gain_tab[s->sgaincod];
525
+    s->bit_alloc.dbknee = ff_ac3_db_per_bit_tab[s->dbkneecod];
526
+    s->bit_alloc.floor = ff_ac3_floor_tab[s->floorcod];
527 527
 
528 528
     /* header size */
529 529
     frame_bits += 65;
... ...
@@ -657,7 +657,7 @@ static int AC3_encode_init(AVCodecContext *avctx)
657 657
     /* frequency */
658 658
     for(i=0;i<3;i++) {
659 659
         for(j=0;j<3;j++)
660
-            if ((ff_ac3_freqs[j] >> i) == freq)
660
+            if ((ff_ac3_sample_rate_tab[j] >> i) == freq)
661 661
                 goto found;
662 662
     }
663 663
     return -1;
... ...
@@ -671,14 +671,14 @@ static int AC3_encode_init(AVCodecContext *avctx)
671 671
     /* bitrate & frame size */
672 672
     bitrate /= 1000;
673 673
     for(i=0;i<19;i++) {
674
-        if ((ff_ac3_bitratetab[i] >> s->halfratecod) == bitrate)
674
+        if ((ff_ac3_bitrate_tab[i] >> s->halfratecod) == bitrate)
675 675
             break;
676 676
     }
677 677
     if (i == 19)
678 678
         return -1;
679 679
     s->bit_rate = bitrate;
680 680
     s->frmsizecod = i << 1;
681
-    s->frame_size_min = ff_ac3_frame_sizes[s->frmsizecod][s->fscod];
681
+    s->frame_size_min = ff_ac3_frame_size_tab[s->frmsizecod][s->fscod];
682 682
     s->bits_written = 0;
683 683
     s->samples_written = 0;
684 684
     s->frame_size = s->frame_size_min;
... ...
@@ -30,7 +30,7 @@
30 30
  * Possible frame sizes.
31 31
  * from ATSC A/52 Table 5.18 Frame Size Code Table.
32 32
  */
33
-const uint16_t ff_ac3_frame_sizes[38][3] = {
33
+const uint16_t ff_ac3_frame_size_tab[38][3] = {
34 34
     { 64,   69,   96   },
35 35
     { 64,   70,   96   },
36 36
     { 80,   87,   120  },
... ...
@@ -75,15 +75,15 @@ const uint16_t ff_ac3_frame_sizes[38][3] = {
75 75
  * Maps audio coding mode (acmod) to number of full-bandwidth channels.
76 76
  * from ATSC A/52 Table 5.8 Audio Coding Mode
77 77
  */
78
-const uint8_t ff_ac3_channels[8] = {
78
+const uint8_t ff_ac3_channels_tab[8] = {
79 79
     2, 1, 2, 3, 3, 4, 4, 5
80 80
 };
81 81
 
82 82
 /* possible frequencies */
83
-const uint16_t ff_ac3_freqs[3] = { 48000, 44100, 32000 };
83
+const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
84 84
 
85 85
 /* possible bitrates */
86
-const uint16_t ff_ac3_bitratetab[19] = {
86
+const uint16_t ff_ac3_bitrate_tab[19] = {
87 87
     32, 40, 48, 56, 64, 80, 96, 112, 128,
88 88
     160, 192, 224, 256, 320, 384, 448, 512, 576, 640
89 89
 };
... ...
@@ -126,7 +126,7 @@ const int16_t ff_ac3_window[256] = {
126 126
 32767,32767,32767,32767,32767,32767,32767,32767,
127 127
 };
128 128
 
129
-const uint8_t ff_ac3_latab[260]= {
129
+const uint8_t ff_ac3_log_add_tab[260]= {
130 130
 0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
131 131
 0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
132 132
 0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
... ...
@@ -155,7 +155,7 @@ const uint8_t ff_ac3_latab[260]= {
155 155
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
156 156
 };
157 157
 
158
-const uint16_t ff_ac3_hth[50][3]= {
158
+const uint16_t ff_ac3_hearing_threshold_tab[50][3]= {
159 159
 { 0x04d0,0x04f0,0x0580 },
160 160
 { 0x04d0,0x04f0,0x0580 },
161 161
 { 0x0440,0x0460,0x04b0 },
... ...
@@ -208,7 +208,7 @@ const uint16_t ff_ac3_hth[50][3]= {
208 208
 { 0x0840,0x0840,0x04e0 },
209 209
 };
210 210
 
211
-const uint8_t ff_ac3_baptab[64]= {
211
+const uint8_t ff_ac3_bap_tab[64]= {
212 212
     0, 1, 1, 1, 1, 1, 2, 2, 3, 3,
213 213
     3, 4, 4, 5, 5, 6, 6, 6, 6, 7,
214 214
     7, 7, 7, 8, 8, 8, 8, 9, 9, 9,
... ...
@@ -218,31 +218,31 @@ const uint8_t ff_ac3_baptab[64]= {
218 218
     15, 15, 15, 15,
219 219
 };
220 220
 
221
-const uint8_t ff_sdecaytab[4]={
221
+const uint8_t ff_ac3_slow_decay_tab[4]={
222 222
     0x0f, 0x11, 0x13, 0x15,
223 223
 };
224 224
 
225
-const uint8_t ff_fdecaytab[4]={
225
+const uint8_t ff_ac3_fast_decay_tab[4]={
226 226
     0x3f, 0x53, 0x67, 0x7b,
227 227
 };
228 228
 
229
-const uint16_t ff_sgaintab[4]= {
229
+const uint16_t ff_ac3_slow_gain_tab[4]= {
230 230
     0x540, 0x4d8, 0x478, 0x410,
231 231
 };
232 232
 
233
-const uint16_t ff_dbkneetab[4]= {
233
+const uint16_t ff_ac3_db_per_bit_tab[4]= {
234 234
     0x000, 0x700, 0x900, 0xb00,
235 235
 };
236 236
 
237
-const int16_t ff_floortab[8]= {
237
+const int16_t ff_ac3_floor_tab[8]= {
238 238
     0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800,
239 239
 };
240 240
 
241
-const uint16_t ff_fgaintab[8]= {
241
+const uint16_t ff_ac3_fast_gain_tab[8]= {
242 242
     0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
243 243
 };
244 244
 
245
-const uint8_t ff_ac3_bndsz[50]={
245
+const uint8_t ff_ac3_critical_band_size_tab[50]={
246 246
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
247 247
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
248 248
     3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
... ...
@@ -24,20 +24,20 @@
24 24
 
25 25
 #include "common.h"
26 26
 
27
-extern const uint16_t ff_ac3_frame_sizes[38][3];
28
-extern const uint8_t  ff_ac3_channels[8];
29
-extern const uint16_t ff_ac3_freqs[3];
30
-extern const uint16_t ff_ac3_bitratetab[19];
27
+extern const uint16_t ff_ac3_frame_size_tab[38][3];
28
+extern const uint8_t  ff_ac3_channels_tab[8];
29
+extern const uint16_t ff_ac3_sample_rate_tab[3];
30
+extern const uint16_t ff_ac3_bitrate_tab[19];
31 31
 extern const int16_t  ff_ac3_window[256];
32
-extern const uint8_t  ff_ac3_latab[260];
33
-extern const uint16_t ff_ac3_hth[50][3];
34
-extern const uint8_t  ff_ac3_baptab[64];
35
-extern const uint8_t  ff_sdecaytab[4];
36
-extern const uint8_t  ff_fdecaytab[4];
37
-extern const uint16_t ff_sgaintab[4];
38
-extern const uint16_t ff_dbkneetab[4];
39
-extern const int16_t  ff_floortab[8];
40
-extern const uint16_t ff_fgaintab[8];
41
-extern const uint8_t  ff_ac3_bndsz[50];
32
+extern const uint8_t  ff_ac3_log_add_tab[260];
33
+extern const uint16_t ff_ac3_hearing_threshold_tab[50][3];
34
+extern const uint8_t  ff_ac3_bap_tab[64];
35
+extern const uint8_t  ff_ac3_slow_decay_tab[4];
36
+extern const uint8_t  ff_ac3_fast_decay_tab[4];
37
+extern const uint16_t ff_ac3_slow_gain_tab[4];
38
+extern const uint16_t ff_ac3_db_per_bit_tab[4];
39
+extern const int16_t  ff_ac3_floor_tab[8];
40
+extern const uint16_t ff_ac3_fast_gain_tab[8];
41
+extern const uint8_t  ff_ac3_critical_band_size_tab[50];
42 42
 
43 43
 #endif /* FFMPEG_AC3TAB_H */