| OLD | NEW |
| 1 /* | 1 /* |
| 2 * DCA compatible decoder | 2 * DCA compatible decoder |
| 3 * Copyright (C) 2004 Gildas Bazin | 3 * Copyright (C) 2004 Gildas Bazin |
| 4 * Copyright (C) 2004 Benjamin Zores | 4 * Copyright (C) 2004 Benjamin Zores |
| 5 * Copyright (C) 2006 Benjamin Larsson | 5 * Copyright (C) 2006 Benjamin Larsson |
| 6 * Copyright (C) 2007 Konstantin Shishkov | 6 * Copyright (C) 2007 Konstantin Shishkov |
| 7 * | 7 * |
| 8 * This file is part of FFmpeg. | 8 * This file is part of FFmpeg. |
| 9 * | 9 * |
| 10 * FFmpeg is free software; you can redistribute it and/or | 10 * FFmpeg is free software; you can redistribute it and/or |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 /** | 25 /** |
| 26 * @file libavcodec/dca.c | 26 * @file libavcodec/dca.c |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include <math.h> | 29 #include <math.h> |
| 30 #include <stddef.h> | 30 #include <stddef.h> |
| 31 #include <stdio.h> | 31 #include <stdio.h> |
| 32 | 32 |
| 33 #include "avcodec.h" | 33 #include "avcodec.h" |
| 34 #include "dsputil.h" | 34 #include "dsputil.h" |
| 35 #include "fft.h" |
| 35 #include "get_bits.h" | 36 #include "get_bits.h" |
| 36 #include "put_bits.h" | 37 #include "put_bits.h" |
| 37 #include "dcadata.h" | 38 #include "dcadata.h" |
| 38 #include "dcahuff.h" | 39 #include "dcahuff.h" |
| 39 #include "dca.h" | 40 #include "dca.h" |
| 40 #include "synth_filter.h" | 41 #include "synth_filter.h" |
| 41 | 42 |
| 42 //#define TRACE | 43 //#define TRACE |
| 43 | 44 |
| 44 #define DCA_PRIM_CHANNELS_MAX (5) | 45 #define DCA_PRIM_CHANNELS_MAX (5) |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 int dynrange_coef; ///< dynamic ra
nge coefficient | 222 int dynrange_coef; ///< dynamic ra
nge coefficient |
| 222 | 223 |
| 223 int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded
high frequency subbands | 224 int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded
high frequency subbands |
| 224 | 225 |
| 225 float lfe_data[2 * DCA_SUBSUBFAMES_MAX * DCA_LFE_MAX * | 226 float lfe_data[2 * DCA_SUBSUBFAMES_MAX * DCA_LFE_MAX * |
| 226 2 /*history */ ]; ///< Low frequency effect data | 227 2 /*history */ ]; ///< Low frequency effect data |
| 227 int lfe_scale_factor; | 228 int lfe_scale_factor; |
| 228 | 229 |
| 229 /* Subband samples history (for ADPCM) */ | 230 /* Subband samples history (for ADPCM) */ |
| 230 float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]; | 231 float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]; |
| 231 DECLARE_ALIGNED_16(float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512]; | 232 DECLARE_ALIGNED(16, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512]; |
| 232 float subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][32]; | 233 float subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][32]; |
| 233 int hist_index[DCA_PRIM_CHANNELS_MAX]; | 234 int hist_index[DCA_PRIM_CHANNELS_MAX]; |
| 234 DECLARE_ALIGNED_16(float, raXin)[32]; | 235 DECLARE_ALIGNED(16, float, raXin)[32]; |
| 235 | 236 |
| 236 int output; ///< type of output | 237 int output; ///< type of output |
| 237 float add_bias; ///< output bias | 238 float add_bias; ///< output bias |
| 238 float scale_bias; ///< output scale | 239 float scale_bias; ///< output scale |
| 239 | 240 |
| 240 DECLARE_ALIGNED_16(float, samples)[1536]; /* 6 * 256 = 1536, might only nee
d 5 */ | 241 DECLARE_ALIGNED(16, float, samples)[1536]; /* 6 * 256 = 1536, might only ne
ed 5 */ |
| 241 const float *samples_chanptr[6]; | 242 const float *samples_chanptr[6]; |
| 242 | 243 |
| 243 uint8_t dca_buffer[DCA_MAX_FRAME_SIZE]; | 244 uint8_t dca_buffer[DCA_MAX_FRAME_SIZE]; |
| 244 int dca_buffer_size; ///< how much data is in the dca_buffer | 245 int dca_buffer_size; ///< how much data is in the dca_buffer |
| 245 | 246 |
| 246 const int8_t* channel_order_tab; ///< channel re
ordering table, lfe and non lfe | 247 const int8_t* channel_order_tab; ///< channel re
ordering table, lfe and non lfe |
| 247 GetBitContext gb; | 248 GetBitContext gb; |
| 248 /* Current position in DCA frame */ | 249 /* Current position in DCA frame */ |
| 249 int current_subframe; | 250 int current_subframe; |
| 250 int current_subsubframe; | 251 int current_subsubframe; |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 | 1238 |
| 1238 if (s->amode<16) { | 1239 if (s->amode<16) { |
| 1239 avctx->channel_layout = dca_core_channel_layout[s->amode]; | 1240 avctx->channel_layout = dca_core_channel_layout[s->amode]; |
| 1240 | 1241 |
| 1241 if (s->lfe) { | 1242 if (s->lfe) { |
| 1242 avctx->channel_layout |= CH_LOW_FREQUENCY; | 1243 avctx->channel_layout |= CH_LOW_FREQUENCY; |
| 1243 s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; | 1244 s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; |
| 1244 } else | 1245 } else |
| 1245 s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; | 1246 s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; |
| 1246 | 1247 |
| 1248 if (s->prim_channels > 0 && |
| 1249 s->channel_order_tab[s->prim_channels - 1] < 0) |
| 1250 return -1; |
| 1251 |
| 1247 if(avctx->request_channels == 2 && s->prim_channels > 2) { | 1252 if(avctx->request_channels == 2 && s->prim_channels > 2) { |
| 1248 channels = 2; | 1253 channels = 2; |
| 1249 s->output = DCA_STEREO; | 1254 s->output = DCA_STEREO; |
| 1250 avctx->channel_layout = CH_LAYOUT_STEREO; | 1255 avctx->channel_layout = CH_LAYOUT_STEREO; |
| 1251 } | 1256 } |
| 1252 } else { | 1257 } else { |
| 1253 av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode
); | 1258 av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode
); |
| 1254 return -1; | 1259 return -1; |
| 1255 } | 1260 } |
| 1256 | 1261 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 AVCodec dca_decoder = { | 1331 AVCodec dca_decoder = { |
| 1327 .name = "dca", | 1332 .name = "dca", |
| 1328 .type = CODEC_TYPE_AUDIO, | 1333 .type = CODEC_TYPE_AUDIO, |
| 1329 .id = CODEC_ID_DTS, | 1334 .id = CODEC_ID_DTS, |
| 1330 .priv_data_size = sizeof(DCAContext), | 1335 .priv_data_size = sizeof(DCAContext), |
| 1331 .init = dca_decode_init, | 1336 .init = dca_decode_init, |
| 1332 .decode = dca_decode_frame, | 1337 .decode = dca_decode_frame, |
| 1333 .close = dca_decode_end, | 1338 .close = dca_decode_end, |
| 1334 .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), | 1339 .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), |
| 1335 }; | 1340 }; |
| OLD | NEW |