[FFmpeg-soc] [soc]: r4402 - in wmapro: wma3.h wma3data.h wma3dec.c
faust3
subversion at mplayerhq.hu
Tue Jun 9 20:37:10 CEST 2009
Author: faust3
Date: Tue Jun 9 20:37:10 2009
New Revision: 4402
Log:
Avoid dynamic calculation of the decorrelation matrix offsets
as long as only up to 6 channels are supported
Modified:
wmapro/wma3.h
wmapro/wma3data.h
wmapro/wma3dec.c
Modified: wmapro/wma3.h
==============================================================================
--- wmapro/wma3.h Tue Jun 9 19:15:39 2009 (r4401)
+++ wmapro/wma3.h Tue Jun 9 20:37:10 2009 (r4402)
@@ -105,7 +105,6 @@ typedef struct WMA3DecodeContext {
uint16_t log2_frame_size; ///< frame size
int8_t num_channels; ///< number of channels
int8_t lfe_channel; ///< lfe channel index
- const float** def_decorrelation_mat; ///< default decorrelation matrix
uint8_t max_num_subframes; ///< maximum number of subframes
int8_t num_possible_block_sizes; ///< nb of supported block sizes
uint16_t min_samples_per_subframe; ///< minimum samples per subframe
Modified: wmapro/wma3data.h
==============================================================================
--- wmapro/wma3data.h Tue Jun 9 19:15:39 2009 (r4401)
+++ wmapro/wma3data.h Tue Jun 9 20:37:10 2009 (r4402)
@@ -585,4 +585,17 @@ static const float ff_wma3_default_decor
0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438,
};
+/**
+ * @brief default decorrelation matrix offsets
+ */
+static const float *ff_wma3_default_decorrelation[] = {
+ NULL,
+ &ff_wma3_default_decorrelation_matrices[0],
+ &ff_wma3_default_decorrelation_matrices[1],
+ &ff_wma3_default_decorrelation_matrices[5],
+ &ff_wma3_default_decorrelation_matrices[14],
+ &ff_wma3_default_decorrelation_matrices[30],
+ &ff_wma3_default_decorrelation_matrices[55]
+};
+
#endif /* AVCODEC_WMA3DATA_H */
Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c Tue Jun 9 19:15:39 2009 (r4401)
+++ wmapro/wma3dec.c Tue Jun 9 20:37:10 2009 (r4402)
@@ -164,8 +164,6 @@ static av_cold int wma_decode_end(AVCode
av_free(s->subwoofer_cutoffs);
av_free(s->sf_offsets);
- av_free(s->def_decorrelation_mat);
-
for (i=0 ; i<BLOCK_NB_SIZES ; i++)
ff_mdct_end(&s->mdct_ctx[i]);
@@ -378,23 +376,6 @@ static av_cold int wma_decode_init(AVCod
s->subwoofer_cutoffs[i] = av_clip(cutoff,4,block_size);
}
- /** set up decorrelation matrixes */
- s->def_decorrelation_mat = av_mallocz(sizeof(float*) * (MAX_CHANNELS + 1));
- if (!s->def_decorrelation_mat) {
- av_log(avctx, AV_LOG_ERROR,
- "failed to allocate decorrelation matrix\n");
- wma_decode_end(avctx);
- return -1;
- }
-
- /** FIXME more than 6 coupled channels not supported */
- s->def_decorrelation_mat[1] = &ff_wma3_default_decorrelation_matrices[0];
- s->def_decorrelation_mat[2] = &ff_wma3_default_decorrelation_matrices[1];
- s->def_decorrelation_mat[3] = &ff_wma3_default_decorrelation_matrices[5];
- s->def_decorrelation_mat[4] = &ff_wma3_default_decorrelation_matrices[14];
- s->def_decorrelation_mat[5] = &ff_wma3_default_decorrelation_matrices[30];
- s->def_decorrelation_mat[6] = &ff_wma3_default_decorrelation_matrices[55];
-
/** calculate sine values for the decorrelation matrix */
for (i=0;i<33;i++)
sin64[i] = sin(i*M_PI / 64.0);
@@ -731,7 +712,7 @@ static int wma_decode_channel_transform(
"coupled channels > 6\n");
}else{
memcpy(chgroup->decorrelation_matrix,
- s->def_decorrelation_mat[chgroup->num_channels],
+ ff_wma3_default_decorrelation[chgroup->num_channels],
sizeof(float) * chgroup->num_channels *
chgroup->num_channels);
}
More information about the FFmpeg-soc
mailing list