Commit dc0793aa authored by vaclav's avatar vaclav
Browse files

port MR, part3

parent 1d8ae90c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -52,5 +52,4 @@ void DeleteNoiseGen( NoiseGen *psNoiseGen )
    return;
}

extern float GetNoise( NoiseGen *psNoiseGen );
extern Word32 GetNoise_fx( NoiseGen *psNoiseGen );
+35 −29
Original line number Diff line number Diff line
@@ -82,17 +82,19 @@ static inline Word16 LogAdd_fx(

    return iRetVal;
}


/*------------------------------------------------------------------------------------------*
 * Function LogAdd()
 *
 *
 *------------------------------------------------------------------------------------------*/

static inline int32_t LogAdd(
    const int32_t iVal1,
    const int32_t iVal2 )
static inline Word32 LogAdd(
    const Word32 iVal1,
    const Word32 iVal2 )
{
    int32_t iRetVal;
    Word32 iRetVal;

    if ( iVal1 > iVal2 )
    {
@@ -109,6 +111,8 @@ static inline int32_t LogAdd(

    return iRetVal;
}


/*------------------------------------------------------------------------------------------*
 * Function PerceptualModel()
 *
@@ -178,16 +182,16 @@ void PerceptualModel_fx(
 *------------------------------------------------------------------------------------------*/

void PerceptualModel(
    const int32_t iMaxQuantBands,
    const int32_t *piRMSEnvelope,
    int32_t *piExcitation,
    int32_t *piSMR )
    const Word32 iMaxQuantBands,
    const Word32 *piRMSEnvelope,
    Word32 *piExcitation,
    Word32 *piSMR )
{
    int32_t n;
    Word32 n;

    for ( n = 0; n < iMaxQuantBands; n++ )
    {
        int32_t iSLOffset;
        Word32 iSLOffset;

        piExcitation[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n];

@@ -205,8 +209,8 @@ void PerceptualModel(
    /* Spread excitation function */
    for ( n = 0; n < iMaxQuantBands; n++ )
    {
        int32_t k;
        const int32_t *piSpread;
        Word32 k;
        const Word32 *piSpread;

        piSpread = &c_aaiSpreadFunction48[n * MAX_BANDS_48];
        piSMR[n] = piExcitation[n] + piSpread[n];
@@ -227,6 +231,8 @@ void PerceptualModel(

    return;
}


/*------------------------------------------------------------------------------------------*
 * Function PerceptualModelStereo()
 *
@@ -234,21 +240,21 @@ void PerceptualModel(
 *------------------------------------------------------------------------------------------*/

void PerceptualModelStereo(
    const int32_t iMaxQuantBands,
    const int32_t *piMSFlags,
    const int32_t *piRMSEnvelope0,
    const int32_t *piRMSEnvelope1,
    int32_t *piExcitation0,
    int32_t *piExcitation1,
    int32_t *piSMR0,
    int32_t *piSMR1 )
    const Word32 iMaxQuantBands,
    const Word32 *piMSFlags,
    const Word32 *piRMSEnvelope0,
    const Word32 *piRMSEnvelope1,
    Word32 *piExcitation0,
    Word32 *piExcitation1,
    Word32 *piSMR0,
    Word32 *piSMR1 )
{
    int32_t n;
    Word32 n;

    for ( n = 0; n < iMaxQuantBands; n++ )
    {
        int32_t iMaxRMSEnv;
        int32_t iSLOffset;
        Word32 iMaxRMSEnv;
        Word32 iSLOffset;

        iMaxRMSEnv = piRMSEnvelope0[n];

@@ -268,8 +274,8 @@ void PerceptualModelStereo(
    /* Spread excitation function */
    for ( n = 0; n < iMaxQuantBands; n++ )
    {
        int32_t k;
        const int32_t *piSpread;
        Word32 k;
        const Word32 *piSpread;

        piSpread = &c_aaiSpreadFunction48[n * MAX_BANDS_48];
        piSMR0[n] = piExcitation0[n] + piSpread[n];
@@ -284,8 +290,8 @@ void PerceptualModelStereo(

    for ( n = 0; n < iMaxQuantBands; n++ )
    {
        int32_t iMaxRMSEnv;
        int32_t iSLOffset;
        Word32 iMaxRMSEnv;
        Word32 iSLOffset;

        iMaxRMSEnv = piRMSEnvelope1[n];

@@ -305,8 +311,8 @@ void PerceptualModelStereo(
    /* Spread excitation function */
    for ( n = 0; n < iMaxQuantBands; n++ )
    {
        int32_t k;
        const int32_t *piSpread;
        Word32 k;
        const Word32 *piSpread;

        piSpread = &c_aaiSpreadFunction48[n * MAX_BANDS_48];
        piSMR1[n] = piExcitation1[n] + piSpread[n];
+33 −10
Original line number Diff line number Diff line
@@ -247,6 +247,8 @@ void DeletePredictionDecoder_fx(

    return;
}


/*-------------------------------------------------------------------*
 * Function ReadPredictors()
 *
@@ -357,10 +359,14 @@ Word16 ReadPredictors_fx(

    return iBitsRead;
}


/* PLC_IMPROVEMENT */
void SetDecodingPassed( PredictionDecoder *psPredictionDecoder )
void SetDecodingPassed(
    PredictionDecoder *psPredictionDecoder )
{
    int32_t n, ch;
    Word32 n, ch;

    for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
    {
        for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
@@ -368,10 +374,16 @@ void SetDecodingPassed( PredictionDecoder *psPredictionDecoder )
            psPredictionDecoder->ppiDecodingFailed[ch][n] = 0;
        }
    }

    return;
}
int32_t AnyDecodingUnresolved( PredictionDecoder *psPredictionDecoder )


Word32 AnyDecodingUnresolved(
    PredictionDecoder *psPredictionDecoder )
{
    int32_t n, ch;
    Word32 n, ch;

    for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
    {
        for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
@@ -382,12 +394,16 @@ int32_t AnyDecodingUnresolved( PredictionDecoder *psPredictionDecoder )
            }
        }
    }

    return 0;
}

void UpdateDecodingFailedStatus( PredictionDecoder *psPredictionDecoder )

void UpdateDecodingFailedStatus(
    PredictionDecoder *psPredictionDecoder )
{
    int32_t n, ch;
    Word32 n, ch;

    for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
    {
        for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
@@ -395,13 +411,17 @@ void UpdateDecodingFailedStatus( PredictionDecoder *psPredictionDecoder )
            psPredictionDecoder->ppiDecodingFailedPrev[ch][n] = psPredictionDecoder->ppiDecodingFailed[ch][n];
        }
    }

    return;
}

void UpdateDecodingUnresolved( PredictionDecoder *psPredictionDecoder )

void UpdateDecodingUnresolved(
    PredictionDecoder *psPredictionDecoder )
{
    int32_t n, ch;
    Word32 n, ch;

    int32_t iCurrentSubSet = psPredictionDecoder->iSubSetId;
    Word32 iCurrentSubSet = psPredictionDecoder->iSubSetId;

    for ( ch = 0; ch < psPredictionDecoder->iChannels; ch++ )
    {
@@ -410,7 +430,7 @@ void UpdateDecodingUnresolved( PredictionDecoder *psPredictionDecoder )

        for ( n = 0; n < psPredictionDecoder->iNumSubSets; n++ )
        {
            int32_t iSubSetActive = get_bit( psPredictionDecoder->piPredChanEnable[ch], n );
            Word32 iSubSetActive = get_bit( psPredictionDecoder->piPredChanEnable[ch], n );
            if ( iSubSetActive == 0 )
            {
                /* Prediction information available inactive subsets (e.g. no Prediction) */
@@ -418,8 +438,11 @@ void UpdateDecodingUnresolved( PredictionDecoder *psPredictionDecoder )
            }
        }
    }

    return;
}


/*-------------------------------------------------------------------*
 * Function ApplyInversePredictors()
 *
+0 −408

File changed.

Preview size limit exceeded, changes collapsed.

+6 −6
Original line number Diff line number Diff line
@@ -187,8 +187,8 @@ RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping(

    for ( n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n++ )
    {
        psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB_fx = (Word32 *) malloc( MAX_BANDS * 2 * sizeof( float ) );
        psRMSEnvelopeGrouping->psGMNodes[n].piQRMSEnvelope = (Word32 *) malloc( MAX_BANDS * 2 * sizeof( int32_t ) );
        psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB_fx = (Word32 *) malloc( MAX_BANDS * 2 * sizeof( Word32 ) );
        psRMSEnvelopeGrouping->psGMNodes[n].piQRMSEnvelope = (Word32 *) malloc( MAX_BANDS * 2 * sizeof( Word32 ) );
        psRMSEnvelopeGrouping->psGMNodes[n].iGroupRMSEnvelopeCost = -1;
        psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty_fx = L_negate( ONE_IN_Q30 );
        psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty_exp = 1;
@@ -703,10 +703,10 @@ static Word32 TryMerge2(

static void ComputeGreedyGroups3(
    RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
    const int32_t iChannels,
    const int32_t iNumBands,
    const int32_t *piBandwidths,
    const int32_t iMaxGroups )
    const Word32 iChannels,
    const Word32 iNumBands,
    const Word32 *piBandwidths,
    const Word32 iMaxGroups )
{

    Word32 iDone = 0;
Loading