st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;
st->g0_mem[i]=st->g1_mem[i]=0;
int sb_decoder_ctl(void *state, int request, void *ptr){   SBDecState *st;   st=(SBDecState*)state;   switch(request)   {   case SPEEX_SET_HIGH_MODE:      st->submodeID = (*(int*)ptr);      break;   case SPEEX_SET_LOW_MODE:      speex_encoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);      break;   case SPEEX_GET_LOW_MODE:      speex_decoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);      break;   case SPEEX_GET_FRAME_SIZE:      (*(int*)ptr) = st->full_frame_size;      break;   case SPEEX_SET_ENH:      speex_decoder_ctl(st->st_low, request, ptr);      st->lpc_enh_enabled = *((int*)ptr);      break;   case SPEEX_SET_MODE:   case SPEEX_SET_QUALITY:      {         int nb_qual;         int quality = (*(int*)ptr);         if (quality < 0)            quality = 0;         if (quality > 10)            quality = 10;         st->submodeID = ((SpeexSBMode*)(st->mode->mode))->quality_map[quality];         nb_qual = ((SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];         speex_decoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);      }      break;   case SPEEX_GET_BITRATE:      speex_decoder_ctl(st->st_low, request, ptr);      if (st->submodes[st->submodeID])         (*(int*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;      else         (*(int*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;      break;   case SPEEX_SET_SAMPLING_RATE:      {         int tmp=(*(int*)ptr);         st->sampling_rate = tmp;         tmp>>=1;         speex_decoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);      }      break;   case SPEEX_GET_SAMPLING_RATE:      (*(int*)ptr)=st->sampling_rate;      break;   case SPEEX_SET_HANDLER:      speex_decoder_ctl(st->st_low, SPEEX_SET_HANDLER, ptr);      break;   case SPEEX_SET_USER_HANDLER:      speex_decoder_ctl(st->st_low, SPEEX_SET_USER_HANDLER, ptr);      break;   case SPEEX_RESET_STATE:      {         int i;         for (i=0;i<2*st->lpcSize;i++)            st->mem_sp[i]=0;         for (i=0;i<QMF_ORDER;i++)            st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;      }      break;   case SPEEX_SET_SUBMODE_ENCODING:      st->encode_submode = (*(int*)ptr);      speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr);      break;   case SPEEX_GET_SUBMODE_ENCODING:      (*(int*)ptr) = st->encode_submode;      break;   case SPEEX_GET_PI_GAIN:      {         int i;         float *g = (float*)ptr;         for (i=0;i<st->nbSubframes;i++)            g[i]=st->pi_gain[i];      }      break;   case SPEEX_GET_EXC:      {         int i;         spx_sig_t *e = (spx_sig_t*)ptr;         for (i=0;i<st->full_frame_size;i++)            e[i]=0;         for (i=0;i<st->frame_size;i++)            e[2*i]=2*st->exc[i];      }      break;   case SPEEX_GET_INNOV:      {         int i;         spx_sig_t *e = (spx_sig_t*)ptr;         for (i=0;i<st->full_frame_size;i++)            e[i]=0;         for (i=0;i<st->frame_size;i++)            e[2*i]=2*st->exc[i];      }      break;   case SPEEX_GET_DTX_STATUS:      speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, ptr);      break;   default:      speex_warning_int("Unknown nb_ctl request: ", request);      return -1;   }   return 0;}