Пример #1
0
/*********************************************************************************
*
* function name: countStaticBitdemand
* description:   count static bit demand include tns  
*
**********************************************************************************/
Word16 countStaticBitdemand(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
                            PSY_OUT_ELEMENT *psyOutElement,
                            Word16 channels, 
							Word16 adtsUsed)
{
  Word32 statBits;
  Word32 ch;
  
  statBits = 0;                                                  

  /* if adts used, add 56 bits */
  if(adtsUsed) statBits += 56;

   
  switch (channels) {
    case 1:
      statBits += SI_ID_BITS+SI_SCE_BITS+SI_ICS_BITS;
      statBits += countTnsBits(&(psyOutChannel[0].tnsInfo),
                               psyOutChannel[0].windowSequence);
       
      switch(psyOutChannel[0].windowSequence){
        case LONG_WINDOW:
        case START_WINDOW:
        case STOP_WINDOW:
          statBits += SI_ICS_INFO_BITS_LONG;
          break;
        case SHORT_WINDOW:
          statBits += SI_ICS_INFO_BITS_SHORT;
          break;
      }
      break;
    case 2:
      statBits += SI_ID_BITS+SI_CPE_BITS+2*SI_ICS_BITS;

      statBits += SI_CPE_MS_MASK_BITS;
      statBits += countMsMaskBits(psyOutChannel[0].sfbCnt,
								  psyOutChannel[0].sfbPerGroup,
								  psyOutChannel[0].maxSfbPerGroup,
								  &psyOutElement->toolsInfo);
       
      switch (psyOutChannel[0].windowSequence) {
        case LONG_WINDOW:
        case START_WINDOW:
        case STOP_WINDOW:
          statBits += SI_ICS_INFO_BITS_LONG;
          break;
        case SHORT_WINDOW:
          statBits += SI_ICS_INFO_BITS_SHORT;
          break;
      }
      for(ch=0; ch<2; ch++)
        statBits += countTnsBits(&(psyOutChannel[ch].tnsInfo),
                                 psyOutChannel[ch].windowSequence);
      break;
  }

  return statBits;
}
Пример #2
0
int countStaticBitdemand(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
                         PSY_OUT_ELEMENT *psyOutElement,
                         int channels)
{

  int statBits=0;
  int ch;

  COUNT_sub_start("countStaticBitdemand");

  MOVE(1); /* counting previous operation */

  BRANCH(2);
  switch(channels) {

  case 1:

    ADD(1);
    statBits+=SI_ID_BITS+SI_SCE_BITS+SI_ICS_BITS;

    PTR_INIT(1); FUNC(2); ADD(1);
    statBits+=countTnsBits(&(psyOutChannel[0].tnsInfo),
                           psyOutChannel[0].windowSequence);

    BRANCH(2);
    switch(psyOutChannel[0].windowSequence){
      case LONG_WINDOW:
      case START_WINDOW:
      case STOP_WINDOW:

        ADD(1);
        statBits+=SI_ICS_INFO_BITS_LONG;
      break;
      case SHORT_WINDOW:

      ADD(1);
      statBits+=SI_ICS_INFO_BITS_SHORT;
      break;
    }
    break;

  case 2:
    ADD(1);
    statBits+=SI_ID_BITS+SI_CPE_BITS+2*SI_ICS_BITS;
    
    ADD(1);
    statBits+=SI_CPE_MS_MASK_BITS;
    
    INDIRECT(1); PTR_INIT(1); FUNC(4); ADD(1);
    statBits+=countMsMaskBits(psyOutChannel[0].sfbCnt,
                              psyOutChannel[0].sfbPerGroup,
                              psyOutChannel[0].maxSfbPerGroup,
                              &psyOutElement->toolsInfo);
    
    PTR_INIT(1); /* psyOutChannel[] */
    
    switch(psyOutChannel[0].windowSequence) {
      
    case LONG_WINDOW:
    case START_WINDOW:
    case STOP_WINDOW:
      
      ADD(1);
      statBits+=SI_ICS_INFO_BITS_LONG;
      break;
      
    case SHORT_WINDOW:
      
      ADD(1);
      statBits+=SI_ICS_INFO_BITS_SHORT;
      break;
    }
    
    PTR_INIT(1); /* psyOutChannel[ch] */
    LOOP(1);
    for(ch=0;ch<2;ch++) {
      
      PTR_INIT(1); FUNC(2); ADD(1);
      statBits+=countTnsBits(&(psyOutChannel[ch].tnsInfo),
                             psyOutChannel[ch].windowSequence);
    }
    
    break;
  }

  COUNT_sub_end();
  
  return statBits;
}