Loading lib_dec/ivas_binRenderer_internal_fx.c +1076 −1084 Original line number Diff line number Diff line Loading @@ -73,10 +73,9 @@ static void ivas_binRenderer_filterModule_fx( Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx]; move16(); // Todo main-pc update: This needs work #ifdef OPT_BIN_REND_V2_NBE_local_disabled #ifdef OPT_BIN_REND_V2_NBE shift_q = add( sub( Q_filterStates, Q_curr ), 1 ); hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr; hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx] = Q_curr; #else /* OPT_BIN_REND_V2_NBE */ Word64 Cldfb_RealBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES]; Word64 Cldfb_ImagBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES]; Loading @@ -84,8 +83,7 @@ static void ivas_binRenderer_filterModule_fx( FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { // Todo main-pc update: This needs work #ifndef OPT_BIN_REND_V2_NBE_local_disabled #ifndef OPT_BIN_REND_V2_NBE set64_fx( &Cldfb_RealBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES ); set64_fx( &Cldfb_ImagBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES ); Loading @@ -107,8 +105,7 @@ static void ivas_binRenderer_filterModule_fx( move64(); move64(); move64(); // Todo main-pc update: This needs work #ifdef OPT_BIN_REND_V2_NBE_local_disabled #ifdef OPT_BIN_REND_V2_NBE Word64 outRealLeft = 0, outRealRight = 0, outImagLeft = 0, outImagRight = 0; move64(); move64(); Loading @@ -117,8 +114,8 @@ static void ivas_binRenderer_filterModule_fx( FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] ); filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx][0] ); filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29 filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29 Loading Loading @@ -148,8 +145,7 @@ static void ivas_binRenderer_filterModule_fx( outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates } // Todo main-pc update: This needs work #ifndef OPT_BIN_REND_V2_NBE_local_disabled #ifndef OPT_BIN_REND_V2_NBE shift_q = add( sub( Q_filterStates, Q_curr ), 1 ); IF( shift_q != 0 ) Loading @@ -167,10 +163,9 @@ static void ivas_binRenderer_filterModule_fx( filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx]; move32(); // Todo main-pc update: This needs work #ifdef OPT_BIN_REND_V2_NBE_local_disabled #ifdef OPT_BIN_REND_V2_NBE /* Left Real and Imag */ Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr -1 Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr outRealLeft = W_mac_32_32( W_mac_32_32( outRealLeft, filterStatesLeftRealPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), neg_temp2, filterTapsLeftImagPtr_fx[0] ); outImagLeft = W_mac_32_32( W_mac_32_32( outImagLeft, filterStatesLeftImagPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsLeftImagPtr_fx[0] ); Loading Loading @@ -390,40 +385,40 @@ static void ivas_binRenderer_filterModule_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } Loading Loading @@ -526,13 +521,13 @@ static void ivas_binRenderer_filterModule_fx( IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hBinRenConvModule->Q_filterStates[pos_idx] = 31; move16(); for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); Loading @@ -543,13 +538,13 @@ static void ivas_binRenderer_filterModule_fx( } ELSE { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hBinRenConvModule->Q_filterStates[pos_idx] = 31; move16(); for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); Loading Loading @@ -644,10 +639,8 @@ static void ivas_binRenderer_filterModule_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } for ( i = 0; i < dim1; i++ ) { IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof( Word32 * ) ) ) == NULL ) { FOR( i = 0; i < dim1; i++ ){ IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof( Word32 * ) ) ) == NULL ){ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } IF( allocate_init_flag == 0 ) Loading Loading @@ -1086,7 +1079,7 @@ static void ivas_binRenderer_filterModule_fx( set32_fx( outImagRightPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); /*Ambisonics input requires different processing*/ if ( EQ_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) IF( EQ_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) { Word32 *inRealPtr_W, *inImagPtr_W; Word32 *inRealPtr_Y, *inImagPtr_Y; Loading @@ -1106,7 +1099,7 @@ static void ivas_binRenderer_filterModule_fx( outImagRightPtr_fx[bandIdx] = L_sub( inImagPtr_W[bandIdx], inImagPtr_Y[bandIdx] ); } } else ELSE { FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { Loading Loading @@ -1163,12 +1156,12 @@ static void ivas_binRenderer_filterModule_fx( * prepare library opening *-----------------------------------------------------------------*/ if ( ( hBinRenderer = (BINAURAL_RENDERER_HANDLE) malloc( sizeof( BINAURAL_RENDERER ) ) ) == NULL ) IF( ( hBinRenderer = (BINAURAL_RENDERER_HANDLE) malloc( sizeof( BINAURAL_RENDERER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Renderer\n" ) ); } if ( ( hBinRenderer->hInputSetup = (IVAS_OUTPUT_SETUP_HANDLE) malloc( sizeof( IVAS_OUTPUT_SETUP ) ) ) == NULL ) IF( ( hBinRenderer->hInputSetup = (IVAS_OUTPUT_SETUP_HANDLE) malloc( sizeof( IVAS_OUTPUT_SETUP ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for output setup Binaural Renderer\n" ) ); } Loading Loading @@ -1784,7 +1777,6 @@ static void ivas_binRenderer_filterModule_fx( /* Compute Convolution */ /* memory reset for the binaural output */ // Todo main-pc update: This optimization seems a bit risky but might be ok #ifndef OPT_SBA_DEC_V2_BE FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { Loading Loading @@ -1903,11 +1895,11 @@ static void ivas_binRenderer_filterModule_fx( modify_Rmat_q_fx( Rmat_local, Rmat_local, sub( shl( q_fact_orig, 1 ), 32 ), Q30 ); if ( hBinRenderer->hInputSetup->is_loudspeaker_setup ) IF( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { rotateFrame_sd_cldfb_fixed( Rmat_local, RealBuffer_fx, ImagBuffer_fx, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); } else ELSE { rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); } Loading Loading @@ -1959,7 +1951,7 @@ static void ivas_binRenderer_filterModule_fx( { FOR( k = 0; k < numTimeSlots; k++ ) { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { /* Combine first and second parts to generate binaural output signal with room effect */ v_add_32( Cldfb_RealBuffer_Binaural_fx[pos_idx][chIdx][k], reverbRe_fx[chIdx][k], Cldfb_RealBuffer_Binaural_fx[pos_idx][chIdx][k], hBinRenderer->conv_band ); // Q6 Loading lib_dec/ivas_jbm_dec_fx.c +14 −7 Original line number Diff line number Diff line Loading @@ -2302,9 +2302,8 @@ ivas_error ivas_jbm_dec_render_fx( return error; } // Todo main-pc update: This might be needed also in the split rendering path IF( st_ivas->hDecoderConfig->Opt_tsm ) { // ideally only needed for LFE channel to q match LFE ch and binaural output of crend // also only needed if q factor is changed by crend IF( NE_16( exp, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { FOR( i = 0; i < nchan_in; i++ ) Loading @@ -2312,7 +2311,6 @@ ivas_error ivas_jbm_dec_render_fx( scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, exp ) ); } } } ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_tc_fx, p_output_fx ); } Loading Loading @@ -2736,6 +2734,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { IF( EQ_16( mc_mode_old, MC_MODE_MCT ) ) { Word16 i; test(); IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { Loading @@ -2759,6 +2758,14 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( return error; } IF( NE_16( 11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { FOR( i = 0; i < nchan_in; i++ ) { scale_sig32( st_ivas->hTcBuffer->tc_fx[i], hTcBuffer->n_samples_granularity, sub( *st_ivas->hCrendWrapper->p_io_qfactor, 11 ) ); } } ivas_binaural_add_LFE_fx( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc_fx, p_output_fx ); } ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_OBJECTS_TD ) ) Loading lib_rend/ivas_crend_fx.c +2 −0 Original line number Diff line number Diff line Loading @@ -2285,6 +2285,7 @@ ivas_error ivas_rend_crendProcessSubframe( ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len ); } // why is this scaling needed ? IF( pCrend->hCrend[0]->hReverb != NULL ) { *pCrend->p_io_qfactor = sub( *pCrend->p_io_qfactor, 2 ); Loading @@ -2293,6 +2294,7 @@ ivas_error ivas_rend_crendProcessSubframe( { FOR( Word16 j = 0; j < n_samples_to_render; j++ ) { // this seems to be assuming input and output buffers are same. Shouldnt this scaling be happening on input[][] ?? output[i][j] = L_shr( output[i][j], 2 ); // Q = *pCrend->p_io_qfactor move32(); } Loading Loading
lib_dec/ivas_binRenderer_internal_fx.c +1076 −1084 Original line number Diff line number Diff line Loading @@ -73,10 +73,9 @@ static void ivas_binRenderer_filterModule_fx( Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx]; move16(); // Todo main-pc update: This needs work #ifdef OPT_BIN_REND_V2_NBE_local_disabled #ifdef OPT_BIN_REND_V2_NBE shift_q = add( sub( Q_filterStates, Q_curr ), 1 ); hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr; hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx] = Q_curr; #else /* OPT_BIN_REND_V2_NBE */ Word64 Cldfb_RealBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES]; Word64 Cldfb_ImagBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES]; Loading @@ -84,8 +83,7 @@ static void ivas_binRenderer_filterModule_fx( FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { // Todo main-pc update: This needs work #ifndef OPT_BIN_REND_V2_NBE_local_disabled #ifndef OPT_BIN_REND_V2_NBE set64_fx( &Cldfb_RealBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES ); set64_fx( &Cldfb_ImagBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES ); Loading @@ -107,8 +105,7 @@ static void ivas_binRenderer_filterModule_fx( move64(); move64(); move64(); // Todo main-pc update: This needs work #ifdef OPT_BIN_REND_V2_NBE_local_disabled #ifdef OPT_BIN_REND_V2_NBE Word64 outRealLeft = 0, outRealRight = 0, outImagLeft = 0, outImagRight = 0; move64(); move64(); Loading @@ -117,8 +114,8 @@ static void ivas_binRenderer_filterModule_fx( FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] ); filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx][0] ); filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29 filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29 Loading Loading @@ -148,8 +145,7 @@ static void ivas_binRenderer_filterModule_fx( outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates } // Todo main-pc update: This needs work #ifndef OPT_BIN_REND_V2_NBE_local_disabled #ifndef OPT_BIN_REND_V2_NBE shift_q = add( sub( Q_filterStates, Q_curr ), 1 ); IF( shift_q != 0 ) Loading @@ -167,10 +163,9 @@ static void ivas_binRenderer_filterModule_fx( filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx]; move32(); // Todo main-pc update: This needs work #ifdef OPT_BIN_REND_V2_NBE_local_disabled #ifdef OPT_BIN_REND_V2_NBE /* Left Real and Imag */ Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr -1 Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr outRealLeft = W_mac_32_32( W_mac_32_32( outRealLeft, filterStatesLeftRealPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), neg_temp2, filterTapsLeftImagPtr_fx[0] ); outImagLeft = W_mac_32_32( W_mac_32_32( outImagLeft, filterStatesLeftImagPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsLeftImagPtr_fx[0] ); Loading Loading @@ -390,40 +385,40 @@ static void ivas_binRenderer_filterModule_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } Loading Loading @@ -526,13 +521,13 @@ static void ivas_binRenderer_filterModule_fx( IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hBinRenConvModule->Q_filterStates[pos_idx] = 31; move16(); for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); Loading @@ -543,13 +538,13 @@ static void ivas_binRenderer_filterModule_fx( } ELSE { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hBinRenConvModule->Q_filterStates[pos_idx] = 31; move16(); for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); Loading Loading @@ -644,10 +639,8 @@ static void ivas_binRenderer_filterModule_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } for ( i = 0; i < dim1; i++ ) { IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof( Word32 * ) ) ) == NULL ) { FOR( i = 0; i < dim1; i++ ){ IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof( Word32 * ) ) ) == NULL ){ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } IF( allocate_init_flag == 0 ) Loading Loading @@ -1086,7 +1079,7 @@ static void ivas_binRenderer_filterModule_fx( set32_fx( outImagRightPtr_fx, 0, CLDFB_NO_CHANNELS_MAX ); /*Ambisonics input requires different processing*/ if ( EQ_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) IF( EQ_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) { Word32 *inRealPtr_W, *inImagPtr_W; Word32 *inRealPtr_Y, *inImagPtr_Y; Loading @@ -1106,7 +1099,7 @@ static void ivas_binRenderer_filterModule_fx( outImagRightPtr_fx[bandIdx] = L_sub( inImagPtr_W[bandIdx], inImagPtr_Y[bandIdx] ); } } else ELSE { FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { Loading Loading @@ -1163,12 +1156,12 @@ static void ivas_binRenderer_filterModule_fx( * prepare library opening *-----------------------------------------------------------------*/ if ( ( hBinRenderer = (BINAURAL_RENDERER_HANDLE) malloc( sizeof( BINAURAL_RENDERER ) ) ) == NULL ) IF( ( hBinRenderer = (BINAURAL_RENDERER_HANDLE) malloc( sizeof( BINAURAL_RENDERER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Renderer\n" ) ); } if ( ( hBinRenderer->hInputSetup = (IVAS_OUTPUT_SETUP_HANDLE) malloc( sizeof( IVAS_OUTPUT_SETUP ) ) ) == NULL ) IF( ( hBinRenderer->hInputSetup = (IVAS_OUTPUT_SETUP_HANDLE) malloc( sizeof( IVAS_OUTPUT_SETUP ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for output setup Binaural Renderer\n" ) ); } Loading Loading @@ -1784,7 +1777,6 @@ static void ivas_binRenderer_filterModule_fx( /* Compute Convolution */ /* memory reset for the binaural output */ // Todo main-pc update: This optimization seems a bit risky but might be ok #ifndef OPT_SBA_DEC_V2_BE FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { Loading Loading @@ -1903,11 +1895,11 @@ static void ivas_binRenderer_filterModule_fx( modify_Rmat_q_fx( Rmat_local, Rmat_local, sub( shl( q_fact_orig, 1 ), 32 ), Q30 ); if ( hBinRenderer->hInputSetup->is_loudspeaker_setup ) IF( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { rotateFrame_sd_cldfb_fixed( Rmat_local, RealBuffer_fx, ImagBuffer_fx, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); } else ELSE { rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); } Loading Loading @@ -1959,7 +1951,7 @@ static void ivas_binRenderer_filterModule_fx( { FOR( k = 0; k < numTimeSlots; k++ ) { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { /* Combine first and second parts to generate binaural output signal with room effect */ v_add_32( Cldfb_RealBuffer_Binaural_fx[pos_idx][chIdx][k], reverbRe_fx[chIdx][k], Cldfb_RealBuffer_Binaural_fx[pos_idx][chIdx][k], hBinRenderer->conv_band ); // Q6 Loading
lib_dec/ivas_jbm_dec_fx.c +14 −7 Original line number Diff line number Diff line Loading @@ -2302,9 +2302,8 @@ ivas_error ivas_jbm_dec_render_fx( return error; } // Todo main-pc update: This might be needed also in the split rendering path IF( st_ivas->hDecoderConfig->Opt_tsm ) { // ideally only needed for LFE channel to q match LFE ch and binaural output of crend // also only needed if q factor is changed by crend IF( NE_16( exp, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { FOR( i = 0; i < nchan_in; i++ ) Loading @@ -2312,7 +2311,6 @@ ivas_error ivas_jbm_dec_render_fx( scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, exp ) ); } } } ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_tc_fx, p_output_fx ); } Loading Loading @@ -2736,6 +2734,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { IF( EQ_16( mc_mode_old, MC_MODE_MCT ) ) { Word16 i; test(); IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { Loading @@ -2759,6 +2758,14 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( return error; } IF( NE_16( 11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { FOR( i = 0; i < nchan_in; i++ ) { scale_sig32( st_ivas->hTcBuffer->tc_fx[i], hTcBuffer->n_samples_granularity, sub( *st_ivas->hCrendWrapper->p_io_qfactor, 11 ) ); } } ivas_binaural_add_LFE_fx( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc_fx, p_output_fx ); } ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_OBJECTS_TD ) ) Loading
lib_rend/ivas_crend_fx.c +2 −0 Original line number Diff line number Diff line Loading @@ -2285,6 +2285,7 @@ ivas_error ivas_rend_crendProcessSubframe( ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len ); } // why is this scaling needed ? IF( pCrend->hCrend[0]->hReverb != NULL ) { *pCrend->p_io_qfactor = sub( *pCrend->p_io_qfactor, 2 ); Loading @@ -2293,6 +2294,7 @@ ivas_error ivas_rend_crendProcessSubframe( { FOR( Word16 j = 0; j < n_samples_to_render; j++ ) { // this seems to be assuming input and output buffers are same. Shouldnt this scaling be happening on input[][] ?? output[i][j] = L_shr( output[i][j], 2 ); // Q = *pCrend->p_io_qfactor move32(); } Loading