ref: 3d1d047b7e5585b24891a88d62969da9b8473503
parent: 586a2b1cac6d1cda1c7787813bd6bb05a25e1992
author: menno <menno>
date: Thu May 18 09:53:20 EDT 2000
Tuned short block switching
--- a/enc_tf.c
+++ b/enc_tf.c
@@ -333,6 +333,10 @@
*****************************************************************************/
{
int chanNum;
+
+ if (next_desired_block_type[1] == ONLY_SHORT_WINDOW)
+ next_desired_block_type[0] = ONLY_SHORT_WINDOW;
+
for (chanNum=0;chanNum<max_ch;chanNum++) {
/* A few definitions: */
/* block_type: Initially, the block_type used in the previous frame. */
--- a/psych.c
+++ b/psych.c
@@ -52,9 +52,9 @@
Source file:
-$Id: psych.c,v 1.53 2000/03/29 17:48:02 menno Exp $
-$Id: psych.c,v 1.53 2000/03/29 17:48:02 menno Exp $
-$Id: psych.c,v 1.53 2000/03/29 17:48:02 menno Exp $
+$Id: psych.c,v 1.54 2000/05/18 13:53:20 menno Exp $
+$Id: psych.c,v 1.54 2000/05/18 13:53:20 menno Exp $
+$Id: psych.c,v 1.54 2000/05/18 13:53:20 menno Exp $
**********************************************************************/
@@ -1186,13 +1186,12 @@
// ,int ch
)
{
-#if 1
int b,i,shb;
double temp;
- double mn, mx, estot[8];
+ double tot, mx, estot[8];
psy_var_long->pe = 0.0;
- for(b = 0; b < part_tbl_long->len; ++b){
+ for(b = 0; b < part_tbl_long->len; b++){
temp = part_tbl_long->width[b]
* log((psy_stvar_long->nb[psy_stvar_long->p_nb + b] + 0.0000000001)
/ (psy_var_long->e[b] + 0.0000000001));
@@ -1205,43 +1204,24 @@
estot[i]=0;
for ( b = 0; b < BLOCK_LEN_SHORT; b++)
estot[i] += psy_var_short->e[i][b];
- estot[i] /= BLOCK_LEN_SHORT;
+ if (estot[i] != 0.0)
+ estot[i] /= BLOCK_LEN_SHORT;
}
- mn = mx = estot[0];
- for (i=0; i < MAX_SHORT_WINDOWS; i++) {
- mn = min(mn, estot[i]);
+ tot = mx = estot[0];
+ for (i=1; i < MAX_SHORT_WINDOWS; i++) {
+ tot += estot[i];
mx = max(mx, estot[i]);
}
shb = 0;
- /* tuned for t1.wav. doesnt effect most other samples */
- if (psy_var_long->pe > 1500) shb = 1;
+ if (psy_var_long->pe > 5600) shb = 1;
- /* big surge of energy - always use short blocks */
- if ( mx > 10*mn) shb = 1;
+ if ((mx/tot) > 0.3) shb = 1;
- /* medium surge, medium pe - use short blocks */
-// if ((mx > 15*mn) && (psy_var_long->pe > 1500)) shb = 1;
if (shb) psy_var_long->pe = 1;
else psy_var_long->pe = 0;
-#else
- int b;
- double temp;
-
- psy_var_long->pe = 0.0;
- for(b = 0; b < part_tbl_long->len; ++b){
- temp = part_tbl_long->width[b]
- * log((psy_stvar_long->nb[psy_stvar_long->p_nb + b] + 0.0000000001)
- / (psy_var_long->e[b] + 0.0000000001));
- temp = min(0,temp);
-
- psy_var_long->pe -= temp;
- }
-// if(psy_var_long->pe > 1800)
-// printf("%f\t\n",psy_var_long->pe);
-#endif
}
void psy_step13(PSY_VARIABLE_LONG *psy_var_long,
@@ -1249,11 +1229,7 @@
// ,int ch
)
{
-#if 0
- if(psy_var_long->pe > 1500) {
-#else
if(psy_var_long->pe == 1) {
-#endif
*block_type = ONLY_SHORT_WINDOW;
} else {
*block_type = ONLY_LONG_WINDOW;
--- a/psych.h
+++ b/psych.h
@@ -163,6 +163,7 @@
double epart[MAX_SHORT_WINDOWS][NSFB_SHORT];
double thr[MAX_SHORT_WINDOWS][BLOCK_LEN_SHORT];
double npart[MAX_SHORT_WINDOWS][NSFB_SHORT];
+ double pe[MAX_SHORT_WINDOWS];
} PSY_VARIABLE_SHORT;
/* added by T. Araki (1997.07.10) end */