From 94974d5d105b4c511f74a14d3c2245f544f4e3cb Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 24 Aug 2023 17:22:04 +1000 Subject: [PATCH 1/5] resolving/removing TODO comments --- lib_com/ivas_dirac_com.c | 2 +- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_dirac_enc.c | 3 --- lib_rend/ivas_cldfb_codec_bitstream.h | 2 -- lib_rend/ivas_lcld_decoder.c | 21 ---------------- lib_rend/ivas_lcld_encoder.c | 20 +-------------- lib_rend/ivas_lcld_prot.h | 6 ----- lib_rend/ivas_splitRendererPost.c | 35 --------------------------- lib_rend/ivas_splitRendererPre.c | 1 - 9 files changed, 3 insertions(+), 89 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 29a057ed76..820bb81231 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -169,7 +169,7 @@ ivas_error ivas_dirac_config( if ( hQMetaData != NULL ) { - if ( enc_dec == ENC || ( ivas_format != SBA_FORMAT && ivas_format != SBA_ISM_FORMAT ) ) /* Todo: This condition should probably be corrected in main */ + if ( enc_dec == ENC || ( ivas_format != SBA_FORMAT && ivas_format != SBA_ISM_FORMAT ) ) { hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 500b95f5e8..0a0e926c21 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -155,7 +155,7 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); /* save old */ - if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) // ToDo; this never happens + if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) { st_ivas->hTcBuffer->num_slots = st_ivas->hSpar->num_slots; st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpar->nb_subframes; diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 3251e30408..a82f5beea4 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -193,9 +193,6 @@ ivas_error ivas_dirac_enc_reconfigure( return error; } - - /* :TODO: if the number of parameter bands change, do a meaningful mapping of parameter buffers from old to new band setting */ - if ( st_ivas->hQMetaData->useLowerRes ) { hDirAC->block_grouping[0] = 0; diff --git a/lib_rend/ivas_cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_codec_bitstream.h index 1ca49b1eda..ceb95cac4e 100644 --- a/lib_rend/ivas_cldfb_codec_bitstream.h +++ b/lib_rend/ivas_cldfb_codec_bitstream.h @@ -39,8 +39,6 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT -// ToDo: file can be removed if SIMPLE_PHASE is removed - enum { BS_READ, diff --git a/lib_rend/ivas_lcld_decoder.c b/lib_rend/ivas_lcld_decoder.c index 27979fddd1..b550b7af52 100644 --- a/lib_rend/ivas_lcld_decoder.c +++ b/lib_rend/ivas_lcld_decoder.c @@ -46,11 +46,8 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define DECODER_ERROR_NONE ( 0 ) // todo: not really used - #define HUFF_READ_SIZE ( 4 ) - /*------------------------------------------------------------------------------------------* * Local structures *------------------------------------------------------------------------------------------*/ @@ -114,8 +111,6 @@ struct LCLD_DECODER NoiseGen *psNoiseGen; - - int32_t iLastError; }; #ifdef ROM_TO_RAM @@ -545,9 +540,6 @@ ivas_error CreateLCLDDecoder( return error; } psLCLDDecoder->psNoiseGen = NULL; // CreateNoiseGen(); // No noise fill for now - - psLCLDDecoder->iLastError = DECODER_ERROR_NONE; - *psLCLDDecoder_out = psLCLDDecoder; return IVAS_ERR_OK; @@ -729,19 +721,6 @@ void DeleteLCLDDecoder( LCLDDecoder *psLCLDDecoder ) } } - -/*------------------------------------------------------------------------------------------* - * Function LCLDDecoderGetError() - * - * - *------------------------------------------------------------------------------------------*/ - -int32_t LCLDDecoderGetError( LCLDDecoder *psLCLDDecoder ) -{ - return psLCLDDecoder->iLastError; -} - - /*------------------------------------------------------------------------------------------* * Local function declarations * diff --git a/lib_rend/ivas_lcld_encoder.c b/lib_rend/ivas_lcld_encoder.c index c7ae7a291f..3a659cc0de 100644 --- a/lib_rend/ivas_lcld_encoder.c +++ b/lib_rend/ivas_lcld_encoder.c @@ -45,8 +45,6 @@ #endif #include "wmc_auto.h" -#define ENCODER_ERROR_NONE ( 0 ) // todo: not really used - /*------------------------------------------------------------------------------------------* * Local structures *------------------------------------------------------------------------------------------*/ @@ -93,7 +91,6 @@ struct LCLD_ENCODER PredictionEncoder *psPredictionEncoder; - int32_t iLastError; }; @@ -311,8 +308,6 @@ ivas_error CreateLCLDEncoder( return error; } - psLCLDEncoder->iLastError = ENCODER_ERROR_NONE; - *psLCLDEncoder_out = psLCLDEncoder; return IVAS_ERR_OK; @@ -477,19 +472,6 @@ void DeleteLCLDEncoder( return; } - -/*------------------------------------------------------------------------------------------* - * Function LCLDEncoderGetError() - * - * - *------------------------------------------------------------------------------------------*/ - -int32_t LCLDEncoderGetError( LCLDEncoder *psLCLDEncoder ) -{ - return psLCLDEncoder->iLastError; -} - - /*------------------------------------------------------------------------------------------* * Local function declarations *------------------------------------------------------------------------------------------*/ @@ -1338,7 +1320,7 @@ static void QuantizeSpectrumDPCM( } } else - { // don't need // ToDo ? + { fPrevReal = 0.0; fPrevImag = 0.0; } diff --git a/lib_rend/ivas_lcld_prot.h b/lib_rend/ivas_lcld_prot.h index 2d60f127dc..19c41a10a7 100644 --- a/lib_rend/ivas_lcld_prot.h +++ b/lib_rend/ivas_lcld_prot.h @@ -51,9 +51,6 @@ ivas_error CreateLCLDEncoder( void DeleteLCLDEncoder( LCLDEncoder *psLCLDEncoder ); -int32_t LCLDEncoderGetError( - LCLDEncoder *psLCLDEncoder ); - int32_t EncodeLCLDFrame( LCLDEncoder *psLCLDEncoder, float ***pppfLCLDReal, @@ -76,9 +73,6 @@ ivas_error CreateLCLDDecoder( void DeleteLCLDDecoder( LCLDDecoder *psLCLDDecoder ); -int32_t LCLDDecoderGetError( - LCLDDecoder *psLCLDDecoder ); - int32_t DecodeLCLDFrame( LCLDDecoder *psLCLDDecoder, ivas_split_rend_bits_t *pBits, diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index ab872c618f..454635d714 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -244,41 +244,6 @@ static int16_t ivas_split_rend_huffman_decode_opt( return (int16_t) ind; } - -/*-----------------------------------------------------------------------------------------* - * Function ivas_split_rend_huffman_decode() - * - * - *-----------------------------------------------------------------------------------------*/ -// ToDo: unused function -static int16_t ivas_split_rend_huffman_decode( - ivas_split_rend_huffman_cfg_t *huff_cfg, - ivas_split_rend_bits_t *pBits ) -{ - int32_t code, bit, num_bits_read, ind; - - code = ivas_split_rend_bitstream_read_int32( pBits, huff_cfg->min_len ); - num_bits_read = huff_cfg->min_len; - - ind = ivas_split_rend_huffman_code_bits_present( huff_cfg->codebook, code, num_bits_read, huff_cfg->sym_len ); - - while ( ind > huff_cfg->sym_len ) - { - bit = ivas_split_rend_bitstream_read_int32( pBits, 1 ); - num_bits_read += 1; - code = code << 1 | bit; - ind = ivas_split_rend_huffman_code_bits_present( huff_cfg->codebook, code, num_bits_read, huff_cfg->sym_len ); - - if ( num_bits_read > huff_cfg->max_len ) - { - assert( 0 ); - } - } - - return (int16_t) ind; -} - - static void ivas_split_rend_unquant_md( BIN_HR_SPLIT_REND_MD_HANDLE hMd, IVAS_SPLIT_REND_POSE_TYPE pose_type, diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 67c02ae608..d6670a8e85 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2691,7 +2691,6 @@ ivas_error ivas_renderMultiBinToSplitBinaural( } /*zero pad*/ -/*TODO: do this inside the LCLD ENC codec */ #ifdef API_5MS if ( pcm_out ) { -- GitLab From caecb7b338a8c3c945bd68861ddff526b0ad4fc6 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 29 Aug 2023 13:56:14 +1000 Subject: [PATCH 2/5] clean up of unused bitstream read write functions in lib_rend/ivas_cldfb_codec_bitstream --- lib_rend/ivas_MSPred.c | 19 +++- lib_rend/ivas_PredDecoder.c | 4 +- lib_rend/ivas_cldfb_codec_bitstream.c | 137 -------------------------- lib_rend/ivas_cldfb_codec_bitstream.h | 32 ------ lib_rend/ivas_lcld_decoder.c | 10 +- lib_rend/ivas_lcld_encoder.c | 12 +-- lib_rend/ivas_lcld_prot.h | 6 ++ 7 files changed, 36 insertions(+), 184 deletions(-) diff --git a/lib_rend/ivas_MSPred.c b/lib_rend/ivas_MSPred.c index 33581631d4..f7e48ce2e0 100644 --- a/lib_rend/ivas_MSPred.c +++ b/lib_rend/ivas_MSPred.c @@ -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() diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index abc78e8940..3ba8c88138 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -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; diff --git a/lib_rend/ivas_cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_codec_bitstream.c index 0b8126c7c5..591f8f484d 100644 --- a/lib_rend/ivas_cldfb_codec_bitstream.c +++ b/lib_rend/ivas_cldfb_codec_bitstream.c @@ -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() * diff --git a/lib_rend/ivas_cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_codec_bitstream.h index ceb95cac4e..0fd6d6a223 100644 --- a/lib_rend/ivas_cldfb_codec_bitstream.h +++ b/lib_rend/ivas_cldfb_codec_bitstream.h @@ -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, diff --git a/lib_rend/ivas_lcld_decoder.c b/lib_rend/ivas_lcld_decoder.c index b550b7af52..39102359a2 100644 --- a/lib_rend/ivas_lcld_decoder.c +++ b/lib_rend/ivas_lcld_decoder.c @@ -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; } } diff --git a/lib_rend/ivas_lcld_encoder.c b/lib_rend/ivas_lcld_encoder.c index 3a659cc0de..82c0438cec 100644 --- a/lib_rend/ivas_lcld_encoder.c +++ b/lib_rend/ivas_lcld_encoder.c @@ -484,7 +484,7 @@ static int32_t CountLCLDBits( const int32_t iNumGroups, const int32_t *piGroupLe static int32_t WriteHeaderInformation( const int32_t iNumBands, ivas_split_rend_bits_t *pBits ); -static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, Bitstream *psBSWrite, int32_t iChannels, int32_t iNumBands ); +static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, ivas_split_rend_bits_t *pBits, int32_t iChannels, int32_t iNumBands ); static int32_t WriteMSInformation( const int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, int32_t iNumMSPredBands, ivas_split_rend_bits_t *pBits ); @@ -614,7 +614,7 @@ int32_t EncodeLCLDFrame( #ifdef ENABLE_PMOD_ADJUST iBitsWritten += WritePmodInformation( psLCLDEncoder->ppiHiSMRFlags, - psLCLDEncoder->psBSWrite, + pBits, psLCLDEncoder->iChannels, psLCLDEncoder->iNumBands ); #endif @@ -1506,7 +1506,7 @@ static int32_t WriteMSInformation( #ifdef SIMPLE_PHASE for ( b = 0; b < iNumMSPredBands; b++ ) { - BSPutBits( psBSWrite, piLRPhaseDiff[b], SIMPLE_PHASE_BITS ); + ivas_split_rend_bitstream_write_int32( pBits, piLRPhaseDiff[b], SIMPLE_PHASE_BITS ); iBitsWritten += SIMPLE_PHASE_BITS; } #else @@ -1684,7 +1684,7 @@ static int32_t WriteRMSEnvelope( #ifdef ENABLE_PMOD_ADJUST static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, - Bitstream *psBSWrite, + ivas_split_rend_bits_t *pBits, int32_t iChannels, int32_t iNumBands ) { @@ -1704,13 +1704,13 @@ static int32_t WritePmodInformation( break; } } - BSPutBits( psBSWrite, anyNonZero, 1 ); + ivas_split_rend_bitstream_write_int32( pBits, anyNonZero, 1 ); iBitsWritten += 1; if ( anyNonZero ) { for ( b = 0; b < iNumBands; b++ ) { - BSPutBits( psBSWrite, flags[b], 1 ); + ivas_split_rend_bitstream_write_int32( pBits, flags[b], 1 ); iBitsWritten += 1; } } diff --git a/lib_rend/ivas_lcld_prot.h b/lib_rend/ivas_lcld_prot.h index 19c41a10a7..fa92e1be5d 100644 --- a/lib_rend/ivas_lcld_prot.h +++ b/lib_rend/ivas_lcld_prot.h @@ -93,6 +93,7 @@ void cplxmult( float r2, float i2 ); +#ifdef SIMPLE_PHASE void rot_pm_pi( float *pr, float *pi ); @@ -105,6 +106,11 @@ void rot_m_pi_2( float *pr, float *pi ); +void rot_zero( + float *pr, + float *pi ); +#endif + int32_t requantPhase( int32_t phaseQ ); -- GitLab From 0a47701f04035360ab6d47e83ba4d2f9e33b27b6 Mon Sep 17 00:00:00 2001 From: azmill Date: Thu, 14 Sep 2023 11:10:31 +1000 Subject: [PATCH 3/5] Fixing some conditional statements in dirac and spar --- lib_com/ivas_dirac_com.c | 2 +- lib_com/ivas_spar_com.c | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 820bb81231..dc4969fda8 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -169,7 +169,7 @@ ivas_error ivas_dirac_config( if ( hQMetaData != NULL ) { - if ( enc_dec == ENC || ( ivas_format != SBA_FORMAT && ivas_format != SBA_ISM_FORMAT ) ) + if ( enc_dec == ENC ) { hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands; } diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 195a51432a..28f4528c17 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -886,15 +886,11 @@ static void ivas_calc_post_pred_per_band( float temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float tmp_re; - // NOTE: What is this doing? - if ( num_dmx != num_ch ) + for ( i = 0; i < num_ch; i++ ) { - for ( i = 0; i < num_ch; i++ ) + for ( j = 0; j < num_ch; j++ ) { - for ( j = 0; j < num_ch; j++ ) - { - dmx_mat_conj[i][j] = mixer_mat[j][i][band_idx]; - } + dmx_mat_conj[i][j] = mixer_mat[j][i][band_idx]; } } -- GitLab From 05163241d9f44d8fdc9704267719bf0c6cae6749 Mon Sep 17 00:00:00 2001 From: azmill Date: Thu, 14 Sep 2023 12:36:18 +1000 Subject: [PATCH 4/5] Fixing warning and unused arg --- lib_com/ivas_dirac_com.c | 2 +- lib_com/ivas_spar_com.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index dc4969fda8..22b726f314 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -169,7 +169,7 @@ ivas_error ivas_dirac_config( if ( hQMetaData != NULL ) { - if ( enc_dec == ENC ) + if ( enc_dec == ENC ) { hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands; } diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 28f4528c17..afcdc832af 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -83,7 +83,7 @@ static void ivas_reorder_array( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][ static void ivas_get_Wscaling_factor( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ***mixer_mat, const int16_t start_band, const int16_t end_band, const int16_t dtx_vad, const int16_t num_ch, const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, const int16_t active_w_vlbr, float *pWscale, const int16_t dyn_active_w_flag ); -static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t num_dmx, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); +static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); static int16_t ivas_is_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim ); @@ -701,7 +701,7 @@ static void ivas_get_Wscaling_factor( { float Gw_sq, g_sq = 0; - ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, pNum_dmx[b * bands_bw], b, postpred_cov_re ); + ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, b, postpred_cov_re ); Gw_sq = cov_real[0][0][b] / max( postpred_cov_re[0][0], IVAS_FLT_EPS ); @@ -877,7 +877,6 @@ static void ivas_calc_post_pred_per_band( float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, - const int16_t num_dmx, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ) { @@ -1251,7 +1250,7 @@ void ivas_calc_c_p_coeffs( if ( num_dmx != num_ch ) { - ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, num_dmx, band_idx, postpred_cov_re ); + ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, band_idx, postpred_cov_re ); if ( num_dmx != 1 ) { -- GitLab From 827058d7844797cd71ad3ea27474af6f8ca46a42 Mon Sep 17 00:00:00 2001 From: azmill Date: Thu, 14 Sep 2023 13:39:32 +1000 Subject: [PATCH 5/5] Fixing more warnings due to arg removal --- lib_com/ivas_spar_com.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index afcdc832af..45472ea441 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -682,7 +682,7 @@ static void ivas_get_Wscaling_factor( { int16_t b, ch; float dm_f_local, abs_val; - float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] = { 0 }; if ( dtx_vad == 0 ) { @@ -701,7 +701,10 @@ static void ivas_get_Wscaling_factor( { float Gw_sq, g_sq = 0; - ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, b, postpred_cov_re ); + if ( num_ch != pNum_dmx[b * bands_bw] ) + { + ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, b, postpred_cov_re ); + } Gw_sq = cov_real[0][0][b] / max( postpred_cov_re[0][0], IVAS_FLT_EPS ); -- GitLab