ref: 6527e23436d1b1014daa099e365c8d5ba10ec3ee
parent: 53eb89ba87c0d1ae8d61a4cf12af83427f5ce4b4
author: menno <menno>
date: Wed Jan 5 18:34:07 EST 2000
Changed block switching
--- a/enc_tf.c
+++ b/enc_tf.c
@@ -45,8 +45,8 @@
enum QC_MOD_SELECT qc_select = AAC_QC; /* later f(encPara) */
enum AAC_PROFILE profile = MAIN;
enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS];
-enum WINDOW_TYPE desired_block_type[MAX_TIME_CHANNELS];
-enum WINDOW_TYPE next_desired_block_type[MAX_TIME_CHANNELS+2];
+enum WINDOW_TYPE desired_block_type;
+enum WINDOW_TYPE next_desired_block_type;
/* Additional variables for AAC */
int aacAllowScalefacs = 1; /* Allow AAC scalefactors to be nonconstant */
@@ -291,7 +291,7 @@
sampling_rate,
chanNum,
&DTimeSigLookAheadBuf[chanNum],
- &next_desired_block_type[chanNum],
+ &next_desired_block_type,
(int)qc_select,
block_size_samples,
chpo_long,
@@ -306,32 +306,30 @@
*
******************************************************************************************************************************/
{
- int chanNum;
- for (chanNum=0;chanNum<max_ch;chanNum++) {
- /* A few definitions: */
- /* block_type: Initially, the block_type used in the previous frame. */
- /* Will be set to the block_type to use this frame. */
- /* A block type will be selected to ensure a meaningful */
- /* window transition. */
- /* next_desired_block_type: Block_type (LONG or SHORT) which the psycho */
- /* model wants to use next frame. The psycho model is */
- /* using a look-ahead buffer. */
- /* desired_block_type: Block_type (LONG or SHORT) which the psycho */
- /* previously wanted to use. It is the desired block_type */
- /* for this frame. */
- if ( (block_type[chanNum]==ONLY_SHORT_WINDOW)||(block_type[chanNum]==LONG_SHORT_WINDOW) ) {
- if ( (desired_block_type[chanNum]==ONLY_LONG_WINDOW)&&(next_desired_block_type[chanNum]==ONLY_LONG_WINDOW) ) {
- block_type[chanNum]=SHORT_LONG_WINDOW;
- } else {
- block_type[chanNum]=ONLY_SHORT_WINDOW;
- }
- } else if (next_desired_block_type[chanNum]==ONLY_SHORT_WINDOW) {
- block_type[chanNum]=LONG_SHORT_WINDOW;
+ int chanNum = 0;
+ /* A few definitions: */
+ /* block_type: Initially, the block_type used in the previous frame. */
+ /* Will be set to the block_type to use this frame. */
+ /* A block type will be selected to ensure a meaningful */
+ /* window transition. */
+ /* next_desired_block_type: Block_type (LONG or SHORT) which the psycho */
+ /* model wants to use next frame. The psycho model is */
+ /* using a look-ahead buffer. */
+ /* desired_block_type: Block_type (LONG or SHORT) which the psycho */
+ /* previously wanted to use. It is the desired block_type */
+ /* for this frame. */
+ if ( (block_type[chanNum]==ONLY_SHORT_WINDOW)||(block_type[chanNum]==LONG_SHORT_WINDOW) ) {
+ if ( (desired_block_type==ONLY_LONG_WINDOW)&&(next_desired_block_type==ONLY_LONG_WINDOW) ) {
+ block_type[chanNum]=SHORT_LONG_WINDOW;
} else {
- block_type[chanNum]=ONLY_LONG_WINDOW;
+ block_type[chanNum]=ONLY_SHORT_WINDOW;
}
- desired_block_type[chanNum]=next_desired_block_type[chanNum];
+ } else if (next_desired_block_type==ONLY_SHORT_WINDOW) {
+ block_type[chanNum]=LONG_SHORT_WINDOW;
+ } else {
+ block_type[chanNum]=ONLY_LONG_WINDOW;
}
+ desired_block_type=next_desired_block_type;
}
// printf("%d %d\n", block_type[0], block_type[1]);
--- a/psych.c
+++ b/psych.c
@@ -52,9 +52,9 @@
Source file:
-$Id: psych.c,v 1.15 2000/01/05 21:41:09 menno Exp $
-$Id: psych.c,v 1.15 2000/01/05 21:41:09 menno Exp $
-$Id: psych.c,v 1.15 2000/01/05 21:41:09 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.16 2000/01/05 23:34:07 menno Exp $
**********************************************************************/
@@ -607,7 +607,7 @@
psy_step11(part_tbl_long, part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], ch);
psy_step12(part_tbl_long, part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan],
&psy_var_long, &psy_var_short, ch);
- psy_step13(&psy_var_long, block_type, ch);
+ psy_step13(&psy_var_long, block_type, no_of_chan);
psy_step14(p_sri, part_tbl_long, part_tbl_short, &psy_stvar_long[no_of_chan],
&psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
psy_step15(use_ms_l, use_ms_s, p_sri, &psy_stvar_long[0], &psy_stvar_short[0], &psy_var_long, &psy_var_short, no_of_chan);
@@ -1155,12 +1155,22 @@
int ch
)
{
-// if (psy_var_long->pe < 1800)
+ static int old_type;
+// if (psy_var_long->pe > 1800)
// printf("%f\n", psy_var_long->pe);
- if(psy_var_long->pe < 1800) {
- *block_type = ONLY_LONG_WINDOW;
- } else {
- *block_type = ONLY_SHORT_WINDOW;
+
+ if (ch == 0) {
+ if(psy_var_long->pe < 1800) {
+ old_type = ONLY_LONG_WINDOW;
+ } else {
+ old_type = ONLY_SHORT_WINDOW;
+ }
+ } else if(ch == 1) {
+ if((psy_var_long->pe < 1800) && (old_type == ONLY_LONG_WINDOW)) {
+ *block_type = ONLY_LONG_WINDOW;
+ } else {
+ *block_type = ONLY_SHORT_WINDOW;
+ }
}
}