changeset 11912:6db8c8adf407 libavcodec

Support DTS-ES extension (XCh) in dca: Cosmetic cleanup Patch by Nick Brereton, nick at nbrereton dot net
author mstorsjo
date Tue, 22 Jun 2010 08:35:44 +0000
parents 180c6aca1f6e
children 80916e795581
files dca.c
diffstat 1 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/dca.c	Tue Jun 22 08:34:51 2010 +0000
+++ b/dca.c	Tue Jun 22 08:35:44 2010 +0000
@@ -341,9 +341,9 @@
                  tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
     }
 
-    for(i = 0; i < 10; i++)
-        for(j = 0; j < 7; j++){
-            if(!bitalloc_codes[i][j]) break;
+    for (i = 0; i < 10; i++)
+        for (j = 0; j < 7; j++){
+            if (!bitalloc_codes[i][j]) break;
             dca_smpl_bitalloc[i+1].offset = bitalloc_offsets[i];
             dca_smpl_bitalloc[i+1].wrap = 1 + (j > 4);
             dca_smpl_bitalloc[i+1].vlc[j].table = &dca_table[dca_vlc_offs[c]];
@@ -491,7 +491,7 @@
 
     /* FIXME: channels mixing levels */
     s->output = s->amode;
-    if(s->lfe) s->output |= DCA_LFE;
+    if (s->lfe) s->output |= DCA_LFE;
 
 #ifdef TRACE
     av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
@@ -543,7 +543,7 @@
    if (level < 5) {
        /* huffman encoded */
        value += get_bitalloc(gb, &dca_scalefactor, level);
-   } else if(level < 8)
+   } else if (level < 8)
        value = get_bits(gb, level + 1);
    return value;
 }
@@ -672,7 +672,7 @@
 
     /* Stereo downmix coefficients */
     if (!base_channel && s->prim_channels > 2) {
-        if(s->downmix) {
+        if (s->downmix) {
             for (j = base_channel; j < s->prim_channels; j++) {
                 s->downmix_coef[j][0] = get_bits(&s->gb, 7);
                 s->downmix_coef[j][1] = get_bits(&s->gb, 7);
@@ -888,7 +888,7 @@
     samples[i+256] = t * coef[0][1] + samples[i+256] * coef[1][1] + samples[i+512] * coef[2][1];
 
 #define DOWNMIX_TO_STEREO(op1, op2) \
-    for(i = 0; i < 256; i++){ \
+    for (i = 0; i < 256; i++){ \
         op1 \
         op2 \
     }
@@ -900,7 +900,7 @@
     float t;
     float coef[DCA_PRIM_CHANNELS_MAX][2];
 
-    for(i=0; i<DCA_PRIM_CHANNELS_MAX; i++) {
+    for (i=0; i<DCA_PRIM_CHANNELS_MAX; i++) {
         coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]];
         coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]];
     }
@@ -1000,15 +1000,15 @@
             /*
              * Extract bits from the bit stream
              */
-            if(!abits){
+            if (!abits){
                 memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
             } else {
                 /* Deal with transients */
                 int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
                 float rscale = quant_step_size * s->scale_factor[k][l][sfi] * s->scalefactor_adj[k][sel];
 
-                if(abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){
-                    if(abits <= 7){
+                if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){
+                    if (abits <= 7){
                         /* Block code */
                         int block_code1, block_code2, size, levels;
 
@@ -1139,17 +1139,17 @@
 
     /* presumably optional information only appears in the core? */
     if (!base_channel) {
-    if (s->timestamp)
-        get_bits(&s->gb, 32);
+        if (s->timestamp)
+            get_bits(&s->gb, 32);
 
-    if (s->aux_data)
-        aux_data_count = get_bits(&s->gb, 6);
+        if (s->aux_data)
+            aux_data_count = get_bits(&s->gb, 6);
 
-    for (i = 0; i < aux_data_count; i++)
-        get_bits(&s->gb, 8);
+        for (i = 0; i < aux_data_count; i++)
+            get_bits(&s->gb, 8);
 
-    if (s->crc_present && (s->downmix || s->dynrange))
-        get_bits(&s->gb, 16);
+        if (s->crc_present && (s->downmix || s->dynrange))
+            get_bits(&s->gb, 16);
     }
 
     return 0;
@@ -1217,7 +1217,7 @@
     uint16_t *sdst = (uint16_t *) dst;
     PutBitContext pb;
 
-    if((unsigned)src_size > (unsigned)max_size) {
+    if ((unsigned)src_size > (unsigned)max_size) {
 //        av_log(NULL, AV_LOG_ERROR, "Input frame size larger then DCA_MAX_FRAME_SIZE!\n");
 //        return -1;
         src_size = max_size;
@@ -1357,7 +1357,7 @@
             s->channel_order_tab[s->prim_channels - 1] < 0)
             return -1;
 
-        if(avctx->request_channels == 2 && s->prim_channels > 2) {
+        if (avctx->request_channels == 2 && s->prim_channels > 2) {
             channels = 2;
             s->output = DCA_STEREO;
             avctx->channel_layout = CH_LAYOUT_STEREO;
@@ -1376,7 +1376,7 @@
     if (!avctx->channels)
         avctx->channels = channels;
 
-    if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
+    if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
         return -1;
     *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels;
 
@@ -1421,7 +1421,7 @@
         s->samples_chanptr[i] = s->samples + i * 256;
     avctx->sample_fmt = SAMPLE_FMT_S16;
 
-    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
+    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
         s->add_bias = 385.0f;
         s->scale_bias = 1.0 / 32768.0;
     } else {