[FFmpeg-soc] AACSBR review: sbr_env_estimate
Alex Converse
alex.converse at gmail.com
Sun Nov 15 20:30:27 CET 2009
Diego has been bugging me to do some review of the sbr code in the soc
svn so here we go...
> // Estimation of current envelope (14496-3 sp04 p218)
> static void sbr_env_estimate(float **e_curr, float ***x_high,
> SpectralBandReplication *sbr, SBRData *ch_data,
> int ch)
> {
> int i, l, m;
> int ilb = sbr->t_env[ch][l] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
> int iub = sbr->t_env[ch][l + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
Danger Will Robinson, l is not yet defined.
>
> if (sbr->bs_interpol_freq) {
> for (l = 0; l < ch_data->bs_num_env[1]; l++) {
> const int env_size = (sbr->t_env[ch][l + 1] - sbr->t_env[ch][l]) << 1;
>
> for (m = 0; m < sbr->m; m++) {
> float sum = 0.0f;
>
> for (i = ilb; i < iub; i++) {
> sum += x_high[m + sbr->k[3]][i][0] * x_high[m + sbr->k[3]][i][0] +
> x_high[m + sbr->k[3]][i][1] * x_high[m + sbr->k[3]][i][1];
> }
> e_curr[l][m] = sum / env_size;
> }
> }
> } else {
> int k, p;
>
> for (l = 0; l < ch_data->bs_num_env[1]; l++) {
> const int env_size = (sbr->t_env[ch][l + 1] - sbr->t_env[ch][l]) << 1;
> const uint16_t *table = ch_data->bs_freq_res[l + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
>
> for (p = 0; p < sbr->n[ch_data->bs_freq_res[l + 1]]; p++) {
> float sum = 0.0f;
> const int den = env_size * (table[p + 1] - table[p] + 1);
>
> for (k = table[p]; k < table[p + 1]; k++) {
> for (i = ilb; i < iub; i++) {
> sum += x_high[k][i][0] * x_high[k][i][0] +
> x_high[k][i][1] * x_high[k][i][1];
> }
> e_curr[l][k - sbr->k[3]] = sum / den;
> }
> }
> }
> }
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Move-ilb-ulb-calculations-to-where-their-dependencie.patch
Type: text/x-patch
Size: 2178 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20091115/22989366/attachment.bin>
More information about the FFmpeg-soc
mailing list