Loading Workspace_msvc/lib_rend.vcxproj +3 −0 Original line number Diff line number Diff line Loading @@ -254,11 +254,14 @@ <ClCompile Include="..\lib_rend\lib_rend.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\lib_rend\ivas_cldfb_codec_bitstream.h" /> <ClInclude Include="..\lib_rend\ivas_CQMFDecoder.h" /> <ClInclude Include="..\lib_rend\ivas_CQMFEncoder.h" /> <ClInclude Include="..\lib_rend\ivas_lcld_rom_tables.h" /> <ClInclude Include="..\lib_rend\ivas_MSPred.h" /> <ClInclude Include="..\lib_rend\ivas_PerceptualModel.h" /> <ClInclude Include="..\lib_rend\ivas_PredDecoder.h" /> <ClInclude Include="..\lib_rend\ivas_PredEncoder.h" /> <ClInclude Include="..\lib_rend\ivas_PredTables.h" /> <ClInclude Include="..\lib_rend\ivas_prot_rend.h" /> <ClInclude Include="..\lib_rend\ivas_RMSEnvGrouping.h" /> Loading lib_rend/ivas_CQMFEncoder.c +165 −38 Original line number Diff line number Diff line Loading @@ -101,18 +101,24 @@ struct CQMF_ENCODER * *------------------------------------------------------------------------------------------*/ CQMFEncoder *CreateCQMFEncoder( ivas_error CreateCQMFEncoder( CQMFEncoder **psCQMFEncoder_out, const int32_t iSampleRate, const int32_t iChannels, const int32_t iTargetBitRate, const int32_t iAllowSidePred ) { int32_t n; CQMFEncoder *psCQMFEncoder = NULL; CQMFEncoder *psCQMFEncoder; ivas_error error; assert( iSampleRate == 48000 ); // Fix psCQMFEncoder = (CQMFEncoder *) malloc( sizeof( CQMFEncoder ) ); if ( ( psCQMFEncoder = (CQMFEncoder *) malloc( sizeof( CQMFEncoder ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } psCQMFEncoder->iSampleRate = iSampleRate; psCQMFEncoder->iChannels = iChannels; psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; Loading @@ -125,7 +131,10 @@ CQMFEncoder *CreateCQMFEncoder( psCQMFEncoder->piBandwidths = c_aiBandwidths48; // Fix psCQMFEncoder->iMSMode = 0; psCQMFEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); if ( ( psCQMFEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } for ( n = 0; n < MAX_BANDS; n++ ) { Loading @@ -137,56 +146,174 @@ CQMFEncoder *CreateCQMFEncoder( psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psCQMFEncoder->iNumBlocks ); psCQMFEncoder->iCommonGrouping = 1; //*Common grouping always on only impacts stereo */ psCQMFEncoder->piNumGroups = (int32_t *) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ) ); psCQMFEncoder->ppiGroupLengths = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ); psCQMFEncoder->pppiRMSEnvelope = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiSMR = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiExcitation = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiAlloc = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiCQMFSignReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiCQMFSignImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiQCQMFReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiQCQMFImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); if ( ( psCQMFEncoder->piNumGroups = (int32_t *) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->ppiGroupLengths = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiRMSEnvelope = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiSMR = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiExcitation = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiAlloc = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } #ifdef ENABLE_PMOD_ADJUST psCQMFEncoder->ppiHiSMRFlags = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ); if ( ( psCQMFEncoder->ppiHiSMRFlags = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } #endif for ( n = 0; n < iChannels; n++ ) { int32_t k; #ifdef ENABLE_PMOD_ADJUST psCQMFEncoder->ppiHiSMRFlags[n] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); ; if ( ( psCQMFEncoder->ppiHiSMRFlags[n] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } #endif psCQMFEncoder->ppiGroupLengths[n] = (int32_t *) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) ); psCQMFEncoder->pppiRMSEnvelope[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiSMR[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiExcitation[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiAlloc[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiCQMFSignReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiCQMFSignImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiQCQMFReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiQCQMFImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); if ( ( psCQMFEncoder->ppiGroupLengths[n] = (int32_t *) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiRMSEnvelope[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiSMR[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiExcitation[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiAlloc[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) { psCQMFEncoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); if ( ( psCQMFEncoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } psCQMFEncoder->pppiCQMFSignReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiCQMFSignImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiQCQMFReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiQCQMFImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); if ( ( psCQMFEncoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } } } if ( ( error = CreatePredictionEncoder( &( psCQMFEncoder->psPredictionEncoder ), iChannels, psCQMFEncoder->iNumBlocks ) ) != IVAS_ERR_OK ) { return error; } psCQMFEncoder->psPredictionEncoder = CreatePredictionEncoder( iChannels, psCQMFEncoder->iNumBlocks ); psCQMFEncoder->iLastError = ENCODER_ERROR_NONE; return psCQMFEncoder; *psCQMFEncoder_out = psCQMFEncoder; return IVAS_ERR_OK; } Loading lib_rend/ivas_CQMFEncoder.h +2 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,8 @@ typedef struct CQMF_ENCODER CQMFEncoder; CQMFEncoder *CreateCQMFEncoder( ivas_error CreateCQMFEncoder( CQMFEncoder **psCQMFEncoder, const int32_t iSampleRate, const int32_t iChannels, const int32_t iTargetBitRate, Loading lib_rend/ivas_PredEncoder.c +79 −26 Original line number Diff line number Diff line Loading @@ -49,53 +49,105 @@ * *-------------------------------------------------------------------*/ PredictionEncoder *CreatePredictionEncoder( ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, const int32_t iNumBlocks ) { int32_t k, n; PredictionEncoder *psPredictionEncoder = NULL; psPredictionEncoder = (PredictionEncoder *) malloc( sizeof( PredictionEncoder ) ); if ( ( psPredictionEncoder = (PredictionEncoder *) malloc( sizeof( PredictionEncoder ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } psPredictionEncoder->iChannels = iChannels; psPredictionEncoder->iNumBlocks = iNumBlocks; psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks ); if ( ( psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( n = 0; n < iNumBlocks; n++ ) { psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) iNumBlocks ); } psPredictionEncoder->pfRxxReal = (float *) malloc( sizeof( float ) * 2 ); psPredictionEncoder->pfRxxImag = (float *) malloc( sizeof( float ) * 2 ); if ( ( psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ); psPredictionEncoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ); if ( ( psPredictionEncoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { psPredictionEncoder->piPredChanEnable[n] = 0; psPredictionEncoder->piNumPredBands[n] = 40; // Will need to be set correctly } psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ); psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ); psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ); if ( ( psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ); psPredictionEncoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ); psPredictionEncoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ); if ( ( psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( k = 0; k < CQMF_BANDS; k++ ) { psPredictionEncoder->ppiPredBandEnable[n][k] = 0; Loading @@ -104,7 +156,9 @@ PredictionEncoder *CreatePredictionEncoder( } } return psPredictionEncoder; *psPredictionEncoder_out = psPredictionEncoder; return IVAS_ERR_OK; } Loading @@ -114,13 +168,12 @@ PredictionEncoder *CreatePredictionEncoder( * *-------------------------------------------------------------------*/ void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) { int32_t n; free( psPredictionEncoder->pfWindow ); free( psPredictionEncoder->pfRxxReal ); free( psPredictionEncoder->pfRxxImag ); for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { Loading lib_rend/ivas_PredEncoder.h +35 −35 Original line number Diff line number Diff line Loading @@ -33,10 +33,6 @@ #ifndef _IVAS_PRED_ENCODER_H_ #define _IVAS_PRED_ENCODER_H_ #ifdef __cplusplus extern "C" { #endif #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT Loading @@ -49,8 +45,8 @@ extern "C" int32_t iNumBlocks; float *pfWindow; float *pfRxxReal; float *pfRxxImag; float pfRxxReal[2]; float pfRxxImag[2]; int32_t *piPredChanEnable; int32_t *piNumPredBands; Loading @@ -66,26 +62,30 @@ extern "C" int32_t **ppiA1Phase; } PredictionEncoder; PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels, ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, const int32_t iNumBlocks ); void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ); void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ); int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, float ***pppfImag ); void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, float ***pppfImag ); int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, ivas_split_rend_bits_t *pBits ); #endif #ifdef __cplusplus } #endif #endif /* _PRED_ENCODER_H_ */ Loading
Workspace_msvc/lib_rend.vcxproj +3 −0 Original line number Diff line number Diff line Loading @@ -254,11 +254,14 @@ <ClCompile Include="..\lib_rend\lib_rend.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\lib_rend\ivas_cldfb_codec_bitstream.h" /> <ClInclude Include="..\lib_rend\ivas_CQMFDecoder.h" /> <ClInclude Include="..\lib_rend\ivas_CQMFEncoder.h" /> <ClInclude Include="..\lib_rend\ivas_lcld_rom_tables.h" /> <ClInclude Include="..\lib_rend\ivas_MSPred.h" /> <ClInclude Include="..\lib_rend\ivas_PerceptualModel.h" /> <ClInclude Include="..\lib_rend\ivas_PredDecoder.h" /> <ClInclude Include="..\lib_rend\ivas_PredEncoder.h" /> <ClInclude Include="..\lib_rend\ivas_PredTables.h" /> <ClInclude Include="..\lib_rend\ivas_prot_rend.h" /> <ClInclude Include="..\lib_rend\ivas_RMSEnvGrouping.h" /> Loading
lib_rend/ivas_CQMFEncoder.c +165 −38 Original line number Diff line number Diff line Loading @@ -101,18 +101,24 @@ struct CQMF_ENCODER * *------------------------------------------------------------------------------------------*/ CQMFEncoder *CreateCQMFEncoder( ivas_error CreateCQMFEncoder( CQMFEncoder **psCQMFEncoder_out, const int32_t iSampleRate, const int32_t iChannels, const int32_t iTargetBitRate, const int32_t iAllowSidePred ) { int32_t n; CQMFEncoder *psCQMFEncoder = NULL; CQMFEncoder *psCQMFEncoder; ivas_error error; assert( iSampleRate == 48000 ); // Fix psCQMFEncoder = (CQMFEncoder *) malloc( sizeof( CQMFEncoder ) ); if ( ( psCQMFEncoder = (CQMFEncoder *) malloc( sizeof( CQMFEncoder ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } psCQMFEncoder->iSampleRate = iSampleRate; psCQMFEncoder->iChannels = iChannels; psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; Loading @@ -125,7 +131,10 @@ CQMFEncoder *CreateCQMFEncoder( psCQMFEncoder->piBandwidths = c_aiBandwidths48; // Fix psCQMFEncoder->iMSMode = 0; psCQMFEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); if ( ( psCQMFEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } for ( n = 0; n < MAX_BANDS; n++ ) { Loading @@ -137,56 +146,174 @@ CQMFEncoder *CreateCQMFEncoder( psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psCQMFEncoder->iNumBlocks ); psCQMFEncoder->iCommonGrouping = 1; //*Common grouping always on only impacts stereo */ psCQMFEncoder->piNumGroups = (int32_t *) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ) ); psCQMFEncoder->ppiGroupLengths = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ); psCQMFEncoder->pppiRMSEnvelope = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiSMR = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiExcitation = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiAlloc = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiCQMFSignReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiCQMFSignImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiQCQMFReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); psCQMFEncoder->pppiQCQMFImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); if ( ( psCQMFEncoder->piNumGroups = (int32_t *) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->ppiGroupLengths = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiRMSEnvelope = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiSMR = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiExcitation = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiAlloc = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } #ifdef ENABLE_PMOD_ADJUST psCQMFEncoder->ppiHiSMRFlags = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ); if ( ( psCQMFEncoder->ppiHiSMRFlags = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } #endif for ( n = 0; n < iChannels; n++ ) { int32_t k; #ifdef ENABLE_PMOD_ADJUST psCQMFEncoder->ppiHiSMRFlags[n] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); ; if ( ( psCQMFEncoder->ppiHiSMRFlags[n] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } #endif psCQMFEncoder->ppiGroupLengths[n] = (int32_t *) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) ); psCQMFEncoder->pppiRMSEnvelope[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiSMR[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiExcitation[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiAlloc[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiCQMFSignReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiCQMFSignImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiQCQMFReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); psCQMFEncoder->pppiQCQMFImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); if ( ( psCQMFEncoder->ppiGroupLengths[n] = (int32_t *) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiRMSEnvelope[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiSMR[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiExcitation[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiAlloc[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) { psCQMFEncoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); if ( ( psCQMFEncoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } psCQMFEncoder->pppiCQMFSignReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiCQMFSignImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiQCQMFReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); psCQMFEncoder->pppiQCQMFImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); if ( ( psCQMFEncoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiCQMFSignImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } if ( ( psCQMFEncoder->pppiQCQMFImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } } } if ( ( error = CreatePredictionEncoder( &( psCQMFEncoder->psPredictionEncoder ), iChannels, psCQMFEncoder->iNumBlocks ) ) != IVAS_ERR_OK ) { return error; } psCQMFEncoder->psPredictionEncoder = CreatePredictionEncoder( iChannels, psCQMFEncoder->iNumBlocks ); psCQMFEncoder->iLastError = ENCODER_ERROR_NONE; return psCQMFEncoder; *psCQMFEncoder_out = psCQMFEncoder; return IVAS_ERR_OK; } Loading
lib_rend/ivas_CQMFEncoder.h +2 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,8 @@ typedef struct CQMF_ENCODER CQMFEncoder; CQMFEncoder *CreateCQMFEncoder( ivas_error CreateCQMFEncoder( CQMFEncoder **psCQMFEncoder, const int32_t iSampleRate, const int32_t iChannels, const int32_t iTargetBitRate, Loading
lib_rend/ivas_PredEncoder.c +79 −26 Original line number Diff line number Diff line Loading @@ -49,53 +49,105 @@ * *-------------------------------------------------------------------*/ PredictionEncoder *CreatePredictionEncoder( ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, const int32_t iNumBlocks ) { int32_t k, n; PredictionEncoder *psPredictionEncoder = NULL; psPredictionEncoder = (PredictionEncoder *) malloc( sizeof( PredictionEncoder ) ); if ( ( psPredictionEncoder = (PredictionEncoder *) malloc( sizeof( PredictionEncoder ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } psPredictionEncoder->iChannels = iChannels; psPredictionEncoder->iNumBlocks = iNumBlocks; psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks ); if ( ( psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( n = 0; n < iNumBlocks; n++ ) { psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) iNumBlocks ); } psPredictionEncoder->pfRxxReal = (float *) malloc( sizeof( float ) * 2 ); psPredictionEncoder->pfRxxImag = (float *) malloc( sizeof( float ) * 2 ); if ( ( psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ); psPredictionEncoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ); if ( ( psPredictionEncoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { psPredictionEncoder->piPredChanEnable[n] = 0; psPredictionEncoder->piNumPredBands[n] = 40; // Will need to be set correctly } psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ); psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ); psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ); psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ); if ( ( psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ); psPredictionEncoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ); psPredictionEncoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ); psPredictionEncoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ); if ( ( psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } if ( ( psPredictionEncoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } for ( k = 0; k < CQMF_BANDS; k++ ) { psPredictionEncoder->ppiPredBandEnable[n][k] = 0; Loading @@ -104,7 +156,9 @@ PredictionEncoder *CreatePredictionEncoder( } } return psPredictionEncoder; *psPredictionEncoder_out = psPredictionEncoder; return IVAS_ERR_OK; } Loading @@ -114,13 +168,12 @@ PredictionEncoder *CreatePredictionEncoder( * *-------------------------------------------------------------------*/ void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) { int32_t n; free( psPredictionEncoder->pfWindow ); free( psPredictionEncoder->pfRxxReal ); free( psPredictionEncoder->pfRxxImag ); for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { Loading
lib_rend/ivas_PredEncoder.h +35 −35 Original line number Diff line number Diff line Loading @@ -33,10 +33,6 @@ #ifndef _IVAS_PRED_ENCODER_H_ #define _IVAS_PRED_ENCODER_H_ #ifdef __cplusplus extern "C" { #endif #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT Loading @@ -49,8 +45,8 @@ extern "C" int32_t iNumBlocks; float *pfWindow; float *pfRxxReal; float *pfRxxImag; float pfRxxReal[2]; float pfRxxImag[2]; int32_t *piPredChanEnable; int32_t *piNumPredBands; Loading @@ -66,26 +62,30 @@ extern "C" int32_t **ppiA1Phase; } PredictionEncoder; PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels, ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, const int32_t iNumBlocks ); void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ); void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ); int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, float ***pppfImag ); void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, float ***pppfImag ); int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, ivas_split_rend_bits_t *pBits ); #endif #ifdef __cplusplus } #endif #endif /* _PRED_ENCODER_H_ */