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;
> }
> }
> }
> }
> }
>
From 819c973cab72d6bb7c52abe78694368de267d04f Mon Sep 17 00:00:00 2001
From: Alex Converse <[email protected]>
Date: Sun, 15 Nov 2009 03:50:46 -0500
Subject: [PATCH 4/4] Move ilb/ulb calculations to where their dependencies are present
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1"
This is a multi-part message in MIME format.
--------------1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
aacsbr.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
--------------1
Content-Type: text/x-patch; name="0004-Move-ilb-ulb-calculations-to-where-their-dependencie.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0004-Move-ilb-ulb-calculations-to-where-their-dependencie.patch"
diff --git a/aacsbr.c b/aacsbr.c
index 2269048..137bbf7 100644
--- a/aacsbr.c
+++ b/aacsbr.c
@@ -1259,12 +1259,12 @@ static void sbr_env_estimate(float **e_curr, float ***x_high,
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;
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;
+ int ilb = sbr->t_env[ch][l] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
+ int iub = sbr->t_env[ch][l + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
for (m = 0; m < sbr->m; m++) {
float sum = 0.0f;
@@ -1281,6 +1281,8 @@ static void sbr_env_estimate(float **e_curr, float ***x_high,
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;
+ int ilb = sbr->t_env[ch][l] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
+ int iub = sbr->t_env[ch][l + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
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++) {
--------------1--
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc