Esempio n. 1
0
/*****************************************************************************

    description:  writes SBR single channel data element
    returns:      number of bits written

*****************************************************************************/
int
WriteEnvSingleChannelElement(HANDLE_SBR_HEADER_DATA     sbrHeaderData,
                             HANDLE_SBR_BITSTREAM_DATA  sbrBitstreamData,
                             HANDLE_SBR_ENV_DATA        sbrEnvData,
                             struct PS_ENC*             h_ps_e,
                             HANDLE_COMMON_DATA         cmonData)

{
  int payloadBits = 0;

  

   /* counting previous operation */

   
  cmonData->sbrHdrBits  = 0;
  cmonData->sbrDataBits = 0;
  cmonData->sbrCrcLen   = 0;

  /* write pure sbr data */
  
  if (sbrEnvData != NULL) {

    /* write header */
      
    payloadBits += encodeSbrHeader (sbrHeaderData,
                                    sbrBitstreamData,
                                    cmonData,
                                    SBR_ID_SCE);


    /* write data */
      
    payloadBits += encodeSbrData (sbrEnvData,
                                  NULL,
                                  cmonData,
                                  SBR_ID_SCE,
                                  sbrHeaderData->sampleRateMode,
                                  sbrHeaderData->sbr_data_extra,
                                  h_ps_e,
                                  sbrBitstreamData->HeaderActive,
                                  0);


  }

  

  return payloadBits;
}
Esempio n. 2
0
/*****************************************************************************

    description:  writes SBR channel pair data element
    returns:      number of bits written

*****************************************************************************/
int
WriteEnvChannelPairElement (HANDLE_SBR_HEADER_DATA     sbrHeaderData,
                            HANDLE_SBR_BITSTREAM_DATA  sbrBitstreamData,
                            HANDLE_SBR_ENV_DATA        sbrEnvDataLeft,
                            HANDLE_SBR_ENV_DATA        sbrEnvDataRight,
                            HANDLE_COMMON_DATA         cmonData)

{
  int payloadBits = 0;

  

   /* counting previous operation */

   
  cmonData->sbrHdrBits  = 0;
  cmonData->sbrDataBits = 0;
  cmonData->sbrCrcLen   = 0;

  /* write pure sbr data */
   
  if ((sbrEnvDataLeft != NULL) && (sbrEnvDataRight != NULL)) {

    /* write header */
     
    payloadBits += encodeSbrHeader (sbrHeaderData,
                                    sbrBitstreamData,
                                    cmonData,
                                    SBR_ID_CPE);


    /* write data */
      
    payloadBits += encodeSbrData (sbrEnvDataLeft,
                                  sbrEnvDataRight,
                                  cmonData,
                                  SBR_ID_CPE,
                                  sbrHeaderData->sampleRateMode,
                                  sbrHeaderData->sbr_data_extra,
                                  NULL,
                                  0,
                                  sbrHeaderData->coupling);


  }
  

  return payloadBits;
}
Esempio n. 3
0
/*****************************************************************************

    functionname: FDKsbrEnc_WriteEnvSingleChannelElement
    description:  writes pure SBR single channel data element
    returns:      number of bits written
    input:
    output:

*****************************************************************************/
INT FDKsbrEnc_WriteEnvSingleChannelElement(
    HANDLE_SBR_HEADER_DATA sbrHeaderData,
    HANDLE_PARAMETRIC_STEREO hParametricStereo,
    HANDLE_SBR_BITSTREAM_DATA sbrBitstreamData, HANDLE_SBR_ENV_DATA sbrEnvData,
    HANDLE_COMMON_DATA cmonData, UINT sbrSyntaxFlags)

{
  INT payloadBits = 0;

  cmonData->sbrHdrBits = 0;
  cmonData->sbrDataBits = 0;

  /* write pure sbr data */
  if (sbrEnvData != NULL) {
    /* write header */
    payloadBits += encodeSbrHeader(sbrHeaderData, sbrBitstreamData, cmonData);

    /* write data */
    payloadBits += encodeSbrData(sbrEnvData, NULL, hParametricStereo, cmonData,
                                 SBR_ID_SCE, 0, sbrSyntaxFlags);
  }
  return payloadBits;
}
Esempio n. 4
0
/*****************************************************************************

    functionname: FDKsbrEnc_WriteEnvChannelPairElement
    description:  writes pure SBR channel pair data element
    returns:      number of bits written
    input:
    output:

*****************************************************************************/
INT FDKsbrEnc_WriteEnvChannelPairElement(
    HANDLE_SBR_HEADER_DATA sbrHeaderData,
    HANDLE_PARAMETRIC_STEREO hParametricStereo,
    HANDLE_SBR_BITSTREAM_DATA sbrBitstreamData,
    HANDLE_SBR_ENV_DATA sbrEnvDataLeft, HANDLE_SBR_ENV_DATA sbrEnvDataRight,
    HANDLE_COMMON_DATA cmonData, UINT sbrSyntaxFlags)

{
  INT payloadBits = 0;
  cmonData->sbrHdrBits = 0;
  cmonData->sbrDataBits = 0;

  /* write pure sbr data */
  if ((sbrEnvDataLeft != NULL) && (sbrEnvDataRight != NULL)) {
    /* write header */
    payloadBits += encodeSbrHeader(sbrHeaderData, sbrBitstreamData, cmonData);

    /* write data */
    payloadBits += encodeSbrData(sbrEnvDataLeft, sbrEnvDataRight,
                                 hParametricStereo, cmonData, SBR_ID_CPE,
                                 sbrHeaderData->coupling, sbrSyntaxFlags);
  }
  return payloadBits;
}