ref: 349fda6ecd3400b2a693bb1506cdc9a2642a36d1
parent: 6527e23436d1b1014daa099e365c8d5ba10ec3ee
author: menno <menno>
date: Thu Jan 6 05:15:51 EST 2000
Small quality fixes
--- a/aac_qc.c
+++ b/aac_qc.c
@@ -30,7 +30,6 @@
+ 0.001 * pow(f,4.0));
/* convert to energy */
- ath -= 114; /* MDCT scaling. From tests by macik and MUS420 code */
ath = pow( 10.0, ath/10.0 );
return ath;
}
@@ -38,22 +37,30 @@
void compute_ath(AACQuantInfo *quantInfo, double ATH[SFB_NUM_MAX])
{
- int sfb,i,start,end;
+ int sfb,i,start=0,end=0;
double ATH_f;
double samp_freq = 44.1;
-
- /* last sfb is not used */
- for ( sfb = 0; sfb < quantInfo->nr_of_sfb; sfb++ ) {
- start = quantInfo->sfb_offset[sfb];
- end = quantInfo->sfb_offset[sfb+1];
- ATH[sfb]=1e99;
- for (i=start ; i < end; i++) {
- if (quantInfo->block_type==ONLY_SHORT_WINDOW)
- ATH_f = ATHformula(samp_freq*i/(2*128)); /* freq in kHz */
- else
- ATH_f = ATHformula(samp_freq*i/(2*1024)); /* freq in kHz */
- ATH[sfb]=min(ATH[sfb],ATH_f);
+ static int width[] = {0, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16};
+ if (quantInfo->block_type==ONLY_SHORT_WINDOW) {
+ for ( sfb = 0; sfb < 14; sfb++ ) {
+ start = start+(width[sfb]*8);
+ end = end+(width[sfb+1]*8);
+ ATH[sfb]=1e99;
+ for (i=start ; i < end; i++) {
+ ATH_f = ATHformula(samp_freq*i/(128)); /* freq in kHz */
+ ATH[sfb]=min(ATH[sfb],ATH_f);
+ }
}
+ } else {
+ for ( sfb = 0; sfb < quantInfo->nr_of_sfb; sfb++ ) {
+ start = quantInfo->sfb_offset[sfb];
+ end = quantInfo->sfb_offset[sfb+1];
+ ATH[sfb]=1e99;
+ for (i=start ; i < end; i++) {
+ ATH_f = ATHformula(samp_freq*i/(1024)); /* freq in kHz */
+ ATH[sfb]=min(ATH[sfb],ATH_f);
+ }
+ }
}
}
@@ -335,11 +342,8 @@
quantInfo -> block_type = block_type[MONO_CHAN];
#if 0
- if (init != (quantInfo->block_type==ONLY_SHORT_WINDOW?2:1)) {
- if (quantInfo->block_type == ONLY_SHORT_WINDOW)
- init = 2;
- else
- init = 1;
+ if (init != quantInfo->block_type) {
+ init = quantInfo->block_type;
compute_ath(quantInfo, ATH);
}
#endif
@@ -410,8 +414,10 @@
for(sb = 0; sb < quantInfo->nr_of_sfb; sb++) {
if (10*log10(energy[MONO_CHAN][sb]+1e-15)>70) {
allowed_dist[MONO_CHAN][sb] = energy[MONO_CHAN][sb] * SigMaskRatio[sb];
-// if (allowed_dist[MONO_CHAN][sb] < ATH[sb])
+// if (allowed_dist[MONO_CHAN][sb] < ATH[sb]) {
+// printf("%d Yes\n", sb);
// allowed_dist[MONO_CHAN][sb] = ATH[sb];
+// }
// printf("%d\t\t%.3f\n", sb, SigMaskRatio[sb]);
} else {
allowed_dist[MONO_CHAN][sb] = energy[MONO_CHAN][sb] * 1.1;
@@ -540,14 +546,10 @@
amp_over = 0;
-#if 1
- noise_thresh = 0;
-#else
noise_thresh = -900;
for ( sb = 0; sb < quantInfo->nr_of_sfb; sb++ )
noise_thresh = max(1.05*noise[sb], noise_thresh);
noise_thresh = min(noise_thresh, 0.0);
-#endif
for (sb = 0; sb < quantInfo->nr_of_sfb; sb++) {
if ((noise[sb] > noise_thresh)&&(quantInfo->book_vector[sb]!=INTENSITY_HCB)&&(quantInfo->book_vector[sb]!=INTENSITY_HCB2)) {
--- a/psych.c
+++ b/psych.c
@@ -52,9 +52,9 @@
Source file:
-$Id: psych.c,v 1.16 2000/01/05 23:34:07 menno Exp $
-$Id: psych.c,v 1.16 2000/01/05 23:34:07 menno Exp $
-$Id: psych.c,v 1.16 2000/01/05 23:34:07 menno Exp $
+$Id: psych.c,v 1.17 2000/01/06 10:15:51 menno Exp $
+$Id: psych.c,v 1.17 2000/01/06 10:15:51 menno Exp $
+$Id: psych.c,v 1.17 2000/01/06 10:15:51 menno Exp $
**********************************************************************/
@@ -1093,7 +1093,7 @@
tempM = min(t, max(psy_stvar_long[2].nb[p1+b], min(part_tbl_long->dyn->bmax[b]*psy_stvar_long[3].en[b], psy_stvar_long[3].nb[p1+b])));
tempS = min(t, max(psy_stvar_long[3].nb[p1+b], min(part_tbl_long->dyn->bmax[b]*psy_stvar_long[2].en[b], psy_stvar_long[2].nb[p1+b])));
- if ((psy_stvar_long[0].nb[p1+b] >= 1.58*psy_stvar_long[1].nb[p1+b])&&(psy_stvar_long[1].nb[p1+b] >= 1.58*psy_stvar_long[0].nb[p1+b])) {
+ if ((psy_stvar_long[0].nb[p1+b] <= 1.58*psy_stvar_long[1].nb[p1+b])&&(psy_stvar_long[1].nb[p1+b] <= 1.58*psy_stvar_long[0].nb[p1+b])) {
psy_stvar_long[2].nb[p1+b] = tempM;
psy_stvar_long[3].nb[p1+b] = tempS;
psy_stvar_long[0].nb[p1+b] = tempL;
@@ -1116,7 +1116,7 @@
tempM = min(t, max(psy_stvar_short[2].nb[i][b], min(part_tbl_short->dyn->bmax[b]*psy_stvar_short[3].en[i][b], psy_stvar_short[3].nb[i][b])));
tempS = min(t, max(psy_stvar_short[3].nb[i][b], min(part_tbl_short->dyn->bmax[b]*psy_stvar_short[2].en[i][b], psy_stvar_short[2].nb[i][b])));
- if ((psy_stvar_short[0].nb[i][b] >= 1.58*psy_stvar_short[1].nb[i][b])&&(psy_stvar_short[1].nb[i][b] >= 1.58*psy_stvar_short[0].nb[i][b])) {
+ if ((psy_stvar_short[0].nb[i][b] <= 1.58*psy_stvar_short[1].nb[i][b])&&(psy_stvar_short[1].nb[i][b] <= 1.58*psy_stvar_short[0].nb[i][b])) {
psy_stvar_short[2].nb[i][b] = tempM;
psy_stvar_short[3].nb[i][b] = tempS;
psy_stvar_short[0].nb[i][b] = tempL;
@@ -1219,7 +1219,7 @@
}
}
- psy_var_long->npart[n] = minthr * (w_high - w_low);
+ psy_var_long->npart[n] = minthr /** (w_high - w_low)*/;
}
for(n = 0; n < p_sri->num_cb_long; n++){
@@ -1262,7 +1262,7 @@
}
}
- psy_var_short->npart[i][n] = minthr * (w_high - w_low);
+ psy_var_short->npart[i][n] = minthr /** (w_high - w_low)*/;
}
for(n = 0; n < p_sri->num_cb_short; n++){