Commit caecb7b3 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

clean up of unused bitstream read write functions in lib_rend/ivas_cldfb_codec_bitstream

parent 94974d5d
Loading
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ int32_t quantPhase(
    return phaseQ;
}


#ifdef SIMPLE_PHASE
/*-------------------------------------------------------------------*
 * Function rot_pm_pi()
 *
@@ -119,6 +119,21 @@ void rot_p_pi_2(
    return;
}

/*-------------------------------------------------------------------*
 * Function rot_zero()
 *
 *
 *-------------------------------------------------------------------*/

void rot_zero(
    float *pr,
    float *pi )
{
    *pr = *pr;
    *pi = *pi;

    return;
}

/*-------------------------------------------------------------------*
 * Function rot_m_pi_2()
@@ -138,7 +153,7 @@ void rot_m_pi_2(

    return;
}

#endif

/*-------------------------------------------------------------------*
 * Function cplxmult()
+2 −2
Original line number Diff line number Diff line
@@ -251,10 +251,10 @@ int32_t ReadPredictors(
                    float fA1Real;
                    float fA1Imag;

                    iA1Mag = BSGetBits( psBSRead, PRED_QUNAT_FILTER_MAG_BITS );
                    iA1Mag = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUNAT_FILTER_MAG_BITS );
                    iBitsRead += PRED_QUNAT_FILTER_MAG_BITS;

                    iA1Phase = BSGetBits( psBSRead, PRED_QUANT_FILTER_PHASE_BITS );
                    iA1Phase = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUANT_FILTER_PHASE_BITS );
                    iBitsRead += PRED_QUANT_FILTER_PHASE_BITS;
                    iA1Phase += PRED_QUANT_FILTER_PHASE_MIN;

+0 −137
Original line number Diff line number Diff line
@@ -39,143 +39,6 @@
#include "prot.h"
#include "wmc_auto.h"


/*------------------------------------------------------------------------------------------*
 * Local ROM tables
 *------------------------------------------------------------------------------------------*/

static const uint32_t MASKS[] = {
    0x00000000,
    0x00000001,
    0x00000003,
    0x00000007,
    0x0000000f,
    0x0000001f,
    0x0000003f,
    0x0000007f,
    0x000000ff,
    0x000001ff,
    0x000003ff,
    0x000007ff,
    0x00000fff,
    0x00001fff,
    0x00003fff,
    0x00007fff,
    0x0000ffff,
    0x0001ffff,
    0x0003ffff,
    0x0007ffff,
    0x000fffff,
    0x001fffff,
    0x003fffff,
    0x007fffff,
    0x00ffffff,
    0x01ffffff,
    0x03ffffff,
    0x07ffffff,
    0x0fffffff,
    0x1fffffff,
    0x3fffffff,
    0x7fffffff,
};


/*------------------------------------------------------------------------------------------*
 * Function BSPutBits()
 *
 *
 *------------------------------------------------------------------------------------------*/

int32_t BSPutBits(
    Bitstream *psBitstream,
    int32_t iValue,
    int32_t iBitCount )
{
    iValue &= MASKS[iBitCount];
    while ( iBitCount )
    {
        int32_t iByte;
        int32_t iRem;
        int32_t iShift;

        iByte = psBitstream->iIndex >> 3;
        iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); /* 8 - psBitstream->iIndex & 0x7; */

        iShift = iBitCount - iRem;
        if ( iShift <= 0 )
        {
            iShift *= -1;
            psBitstream->puchBuffer[iByte] += (uint8_t) ( iValue << iShift );
            psBitstream->iIndex += iBitCount;
            iBitCount = 0;
        }
        else
        {
            psBitstream->puchBuffer[iByte] += (uint8_t) ( iValue >> iShift );
            iValue &= MASKS[iShift];
            psBitstream->iIndex += iRem;
            iBitCount -= iRem;
        }
    }

    if ( psBitstream->iDirection != BS_WRITE )
    {
        psBitstream->iError = BS_ERROR_FAIL;
    }

    return psBitstream->iError;
}


/*------------------------------------------------------------------------------------------*
 * Function BSGetBits()
 *
 *
 *------------------------------------------------------------------------------------------*/

int32_t BSGetBits(
    Bitstream *psBitstream,
    int32_t iBitCount )
{
    int32_t iValue = 0;

    while ( iBitCount )
    {
        uint8_t uchByte;
        int32_t iByte;
        int32_t iRem;
        int32_t iShift;

        iByte = psBitstream->iIndex >> 3;
        iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); /* 8 - psBitstream->iIndex & 0x7; */
        uchByte = psBitstream->puchBuffer[iByte];
        iShift = iBitCount - iRem;

        if ( iShift <= 0 )
        {
            iShift *= -1;
            iValue += (int32_t) ( ( uchByte >> iShift ) & MASKS[iBitCount] );
            psBitstream->iIndex += iBitCount;
            iBitCount = 0;
        }
        else
        {
            uchByte &= MASKS[iRem];
            iValue += ( ( (int32_t) uchByte ) << iShift );
            psBitstream->iIndex += iRem;
            iBitCount -= iRem;
        }
    }

    if ( psBitstream->iDirection != BS_READ )
    {
        psBitstream->iError = BS_ERROR_FAIL;
    }

    return iValue;
}


/*------------------------------------------------------------------------------------------*
 * Function BSForceBack()
 *
+0 −32
Original line number Diff line number Diff line
@@ -39,38 +39,6 @@

#ifdef SPLIT_REND_WITH_HEAD_ROT

enum
{
    BS_READ,
    BS_WRITE
};

enum
{
    BS_ERROR_NONE,
    BS_ERROR_FAIL
};

typedef struct BITSTREAM
{
    int32_t iMaxBuffer;
    int32_t iDirection;
    int32_t iBufferEnd;
    int32_t iBufferStart;
    int32_t iIndex;
    int32_t iError;
    uint8_t *puchBuffer;
} Bitstream;

int32_t BSPutBits(
    Bitstream *psBitstream,
    int32_t iValue,
    int32_t iBitCount );

int32_t BSGetBits(
    Bitstream *psBitstream,
    int32_t iBitCount );

int32_t BSForceBack(
    ivas_split_rend_bits_t *pBits,
    int32_t iValue,
+5 −5
Original line number Diff line number Diff line
@@ -786,7 +786,7 @@ int32_t DecodeLCLDFrame(
    ReadRMSEnvelope( psLCLDDecoder->iChannels, (const int32_t *) psLCLDDecoder->piNumGroups, psLCLDDecoder->iNumBands, psLCLDDecoder->pppiRMSEnvelope, pBits );

#ifdef ENABLE_PMOD_ADJUST
    ReadPmodInformation( psLCLDDecoder->ppiHiSMRFlags, psLCLDDecoder->psBSRead, psLCLDDecoder->iChannels, psLCLDDecoder->iNumBands );
    ReadPmodInformation( psLCLDDecoder->ppiHiSMRFlags, pBits, psLCLDDecoder->iChannels, psLCLDDecoder->iNumBands );
#endif

    ReadAllocInformation( &psLCLDDecoder->iAllocOffset, pBits );
@@ -1199,7 +1199,7 @@ static int32_t ReadMSInformation(
#ifdef SIMPLE_PHASE
            for ( n = 0; n < iNumMSPredBands; n++ )
            {
                piLRPhaseDiffs[n] = BSGetBits( psBSRead, SIMPLE_PHASE_BITS );
                piLRPhaseDiffs[n] = ivas_split_rend_bitstream_read_int32( pBits, SIMPLE_PHASE_BITS );
                iBitsRead += SIMPLE_PHASE_BITS;
            }
#else
@@ -1441,7 +1441,7 @@ static int32_t ReadRMSEnvelope(


#ifdef ENABLE_PMOD_ADJUST
static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, Bitstream *psBSRead, int32_t iChannels, int32_t iNumBands )
static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, ivas_split_rend_bits_t *pBits, int32_t iChannels, int32_t iNumBands )
{
    int32_t iBitsRead;
    int32_t c;
@@ -1449,13 +1449,13 @@ static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, Bitstream *psBSRead
    for ( c = 0; c < iChannels; c++ )
    {
        int32_t b;
        int32_t iFlags = BSGetBits( psBSRead, 1 );
        int32_t iFlags = ivas_split_rend_bitstream_read_int32( pBits, 1 );
        iBitsRead += 1;
        if ( iFlags )
        {
            for ( b = 0; b < iNumBands; b++ )
            {
                ppiHiSMRFlags[c][b] = BSGetBits( psBSRead, 1 );
                ppiHiSMRFlags[c][b] = ivas_split_rend_bitstream_read_int32( pBits, 1 );
                iBitsRead += 1;
            }
        }
Loading