Loading lib_com/cldfb_fx.c +7 −1 Original line number Diff line number Diff line Loading @@ -1422,6 +1422,11 @@ ivas_error openCldfb_ivas_fx( move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT hs->cldfb_state_multiStates = 0; move16(); #endif *h_cldfb = hs; move16(); Loading @@ -1433,10 +1438,11 @@ ivas_error getLongCLDFBStates( HANDLE_CLDFB_FILTER_BANK h_cldfb , /* i/o: fil Word16 len ) { free( h_cldfb->cldfb_state_fx ); IF( ( h_cldfb->cldfb_state_fx = (Word32 *) malloc( sizeof( Word32 ) ) ) == NULL ) IF( ( h_cldfb->cldfb_state_fx = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate long states memory for CLDFB" ); } set32_fx( h_cldfb->cldfb_state_fx, 0, len ); return IVAS_ERR_OK; } #endif Loading lib_com/stat_com.h +1 −0 Original line number Diff line number Diff line Loading @@ -656,6 +656,7 @@ typedef struct ivas_cldfb_filter_bank_struct /* main filter state */ Word32 *cldfb_state_fx; // Q_cldfb_state Word16 cldfb_state_length; Word16 cldfb_state_multiStates; /*multiple states per channel*/ Word16 cldfb_size; Word16 Q_cldfb_state; Loading lib_isar/lib_isar_pre_rend.c +5 −2 Original line number Diff line number Diff line Loading @@ -133,8 +133,11 @@ ivas_error ISAR_PRE_REND_open( #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT IF( createLongStates ) { Word16 buf_len = buf_len = sub( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch]->p_filter_length, hSplitRendWrapper->hCldfbHandles->cldfbAna[ch]->no_channels ); getLongCLDFBStates( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] , buf_len * RENDERER_MAX_ISM_INPUTS ); HANDLE_CLDFB_FILTER_BANK pCldfbAna = hSplitRendWrapper->hCldfbHandles->cldfbAna[ch]; pCldfbAna->cldfb_state_multiStates = 1; /*Re-allocate CLDFB Analysis states*/ Word16 buf_len = buf_len = sub( pCldfbAna->p_filter_length, pCldfbAna->no_channels ); getLongCLDFBStates( pCldfbAna, buf_len * RENDERER_MAX_ISM_INPUTS ); } #endif } Loading lib_rend/lib_rend_fx.c +78 −1 Original line number Diff line number Diff line Loading @@ -4398,11 +4398,18 @@ static ivas_error isar_pre_rend_init( { isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); } #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT /*call with additional flag to indicate long ana states*/ IF( ( error = ISAR_PRE_REND_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0, 1 ) ) != IVAS_ERR_OK ) { return error; } #else IF( ( error = ISAR_PRE_REND_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0 ) ) != IVAS_ERR_OK ) { return error; } #endif } /* We may need to change the allocated buffer size if a new input is added. Loading Loading @@ -7202,6 +7209,52 @@ static void renderIsmToMasa( return; } #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT /*Manage States pointer for next renderInputIsm call in case of multiple states per channel*/ static void renderActiveInputsIsm_manageCldfbAnaStates( int num_poses, HANDLE_CLDFB_FILTER_BANK * pCurCldfbAna , Word32* cldfb_states_orig, int MODE) { IF( pCurCldfbAna[0]->cldfb_state_multiStates > 0 ) { int pos_idx, ch; FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { Word32 **pCurStatePtr = &( pCurCldfbAna[pos_idx + ch]->cldfb_state_fx ); int states_len = sub( pCurCldfbAna[pos_idx + ch]->p_filter_length, pCurCldfbAna[pos_idx + ch]->no_channels ); IF( EQ_32( MODE, 0 ) ) /*MODE 0 = Backup*/ { cldfb_states_orig[pos_idx + ch] = *pCurStatePtr; } IF( EQ_32( MODE, 1 ) ) /*MODE 1 = update*/ { /*Update*/ // if ( i > 0 ) { *pCurStatePtr += states_len; } } IF( EQ_32( MODE, 2 ) ) /*MODE 2 = restore*/ { /*restore if last iteration*/ // if ( EQ_32( i, sub( RENDERER_MAX_ISM_INPUTS, 1 ) ) ) { *pCurStatePtr = cldfb_states_orig[pos_idx + ch]; } } } } } } #endif static ivas_error renderInputIsm( input_ism *ismInput, const AUDIO_CONFIG outConfig, Loading Loading @@ -7304,8 +7357,26 @@ static ivas_error renderActiveInputsIsm( ivas_error error; Word16 input_q = outAudio.q_factor; move16(); #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT Word32 cldfb_states_orig[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /*Array has size of maximum number of cldfbAna state handles*/ int num_poses; num_poses = hIvasRend->inputsIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; move32(); set32_fx( cldfb_states_orig, 0, MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); /*Backup states*/ renderActiveInputsIsm_manageCldfbAnaStates( num_poses, &( hIvasRend->inputsIsm->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna ), cldfb_states_orig, 0 ); #endif FOR( ( i = 0, pCurrentInput = hIvasRend->inputsIsm ); i < RENDERER_MAX_ISM_INPUTS; ( ++i, ++pCurrentInput ) ) { #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT IF( i > 0 ) { /*Update States*/ renderActiveInputsIsm_manageCldfbAnaStates( num_poses, &( pCurrentInput->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna ), NULL, 1 ); } #endif IF( EQ_32( pCurrentInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ Loading @@ -7318,6 +7389,7 @@ static ivas_error renderActiveInputsIsm( { return error; } FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) { outAudio.data_fx[j] = L_shl( outAudio.data_fx[j], sub( sub( input_q, 1 ), ( *outAudio.pq_fact ) ) ); /* Q(input_q - 1) */ Loading @@ -7326,6 +7398,11 @@ static ivas_error renderActiveInputsIsm( *outAudio.pq_fact = sub( input_q, 1 ); move16(); } #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT /*Restore states*/ renderActiveInputsIsm_manageCldfbAnaStates( num_poses, &( hIvasRend->inputsIsm->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna ), cldfb_states_orig, 2 ); #endif return IVAS_ERR_OK; } Loading Loading
lib_com/cldfb_fx.c +7 −1 Original line number Diff line number Diff line Loading @@ -1422,6 +1422,11 @@ ivas_error openCldfb_ivas_fx( move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT hs->cldfb_state_multiStates = 0; move16(); #endif *h_cldfb = hs; move16(); Loading @@ -1433,10 +1438,11 @@ ivas_error getLongCLDFBStates( HANDLE_CLDFB_FILTER_BANK h_cldfb , /* i/o: fil Word16 len ) { free( h_cldfb->cldfb_state_fx ); IF( ( h_cldfb->cldfb_state_fx = (Word32 *) malloc( sizeof( Word32 ) ) ) == NULL ) IF( ( h_cldfb->cldfb_state_fx = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate long states memory for CLDFB" ); } set32_fx( h_cldfb->cldfb_state_fx, 0, len ); return IVAS_ERR_OK; } #endif Loading
lib_com/stat_com.h +1 −0 Original line number Diff line number Diff line Loading @@ -656,6 +656,7 @@ typedef struct ivas_cldfb_filter_bank_struct /* main filter state */ Word32 *cldfb_state_fx; // Q_cldfb_state Word16 cldfb_state_length; Word16 cldfb_state_multiStates; /*multiple states per channel*/ Word16 cldfb_size; Word16 Q_cldfb_state; Loading
lib_isar/lib_isar_pre_rend.c +5 −2 Original line number Diff line number Diff line Loading @@ -133,8 +133,11 @@ ivas_error ISAR_PRE_REND_open( #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT IF( createLongStates ) { Word16 buf_len = buf_len = sub( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch]->p_filter_length, hSplitRendWrapper->hCldfbHandles->cldfbAna[ch]->no_channels ); getLongCLDFBStates( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] , buf_len * RENDERER_MAX_ISM_INPUTS ); HANDLE_CLDFB_FILTER_BANK pCldfbAna = hSplitRendWrapper->hCldfbHandles->cldfbAna[ch]; pCldfbAna->cldfb_state_multiStates = 1; /*Re-allocate CLDFB Analysis states*/ Word16 buf_len = buf_len = sub( pCldfbAna->p_filter_length, pCldfbAna->no_channels ); getLongCLDFBStates( pCldfbAna, buf_len * RENDERER_MAX_ISM_INPUTS ); } #endif } Loading
lib_rend/lib_rend_fx.c +78 −1 Original line number Diff line number Diff line Loading @@ -4398,11 +4398,18 @@ static ivas_error isar_pre_rend_init( { isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); } #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT /*call with additional flag to indicate long ana states*/ IF( ( error = ISAR_PRE_REND_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0, 1 ) ) != IVAS_ERR_OK ) { return error; } #else IF( ( error = ISAR_PRE_REND_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0 ) ) != IVAS_ERR_OK ) { return error; } #endif } /* We may need to change the allocated buffer size if a new input is added. Loading Loading @@ -7202,6 +7209,52 @@ static void renderIsmToMasa( return; } #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT /*Manage States pointer for next renderInputIsm call in case of multiple states per channel*/ static void renderActiveInputsIsm_manageCldfbAnaStates( int num_poses, HANDLE_CLDFB_FILTER_BANK * pCurCldfbAna , Word32* cldfb_states_orig, int MODE) { IF( pCurCldfbAna[0]->cldfb_state_multiStates > 0 ) { int pos_idx, ch; FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { Word32 **pCurStatePtr = &( pCurCldfbAna[pos_idx + ch]->cldfb_state_fx ); int states_len = sub( pCurCldfbAna[pos_idx + ch]->p_filter_length, pCurCldfbAna[pos_idx + ch]->no_channels ); IF( EQ_32( MODE, 0 ) ) /*MODE 0 = Backup*/ { cldfb_states_orig[pos_idx + ch] = *pCurStatePtr; } IF( EQ_32( MODE, 1 ) ) /*MODE 1 = update*/ { /*Update*/ // if ( i > 0 ) { *pCurStatePtr += states_len; } } IF( EQ_32( MODE, 2 ) ) /*MODE 2 = restore*/ { /*restore if last iteration*/ // if ( EQ_32( i, sub( RENDERER_MAX_ISM_INPUTS, 1 ) ) ) { *pCurStatePtr = cldfb_states_orig[pos_idx + ch]; } } } } } } #endif static ivas_error renderInputIsm( input_ism *ismInput, const AUDIO_CONFIG outConfig, Loading Loading @@ -7304,8 +7357,26 @@ static ivas_error renderActiveInputsIsm( ivas_error error; Word16 input_q = outAudio.q_factor; move16(); #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT Word32 cldfb_states_orig[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /*Array has size of maximum number of cldfbAna state handles*/ int num_poses; num_poses = hIvasRend->inputsIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; move32(); set32_fx( cldfb_states_orig, 0, MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); /*Backup states*/ renderActiveInputsIsm_manageCldfbAnaStates( num_poses, &( hIvasRend->inputsIsm->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna ), cldfb_states_orig, 0 ); #endif FOR( ( i = 0, pCurrentInput = hIvasRend->inputsIsm ); i < RENDERER_MAX_ISM_INPUTS; ( ++i, ++pCurrentInput ) ) { #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT IF( i > 0 ) { /*Update States*/ renderActiveInputsIsm_manageCldfbAnaStates( num_poses, &( pCurrentInput->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna ), NULL, 1 ); } #endif IF( EQ_32( pCurrentInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ Loading @@ -7318,6 +7389,7 @@ static ivas_error renderActiveInputsIsm( { return error; } FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) { outAudio.data_fx[j] = L_shl( outAudio.data_fx[j], sub( sub( input_q, 1 ), ( *outAudio.pq_fact ) ) ); /* Q(input_q - 1) */ Loading @@ -7326,6 +7398,11 @@ static ivas_error renderActiveInputsIsm( *outAudio.pq_fact = sub( input_q, 1 ); move16(); } #ifdef FIX_2436_RENDERER_CLDFBSTATES_EACH_ISM_INPUT /*Restore states*/ renderActiveInputsIsm_manageCldfbAnaStates( num_poses, &( hIvasRend->inputsIsm->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna ), cldfb_states_orig, 2 ); #endif return IVAS_ERR_OK; } Loading