Commit 27acb769 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix split rendering issues with merge of OPT_BIN_RENDERER_V2

parent e4b1213a
Loading
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -1869,7 +1869,6 @@ void ivas_binRenderer_fx(
    {
        FOR( k = 0; k < numTimeSlots; k++ )
        {

            set64_fx( Cldfb_RealBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX );
            set64_fx( Cldfb_ImagBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX );
        }
@@ -2050,7 +2049,9 @@ void ivas_binRenderer_fx(
        Word32 reverbIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
        Word32 inRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
        Word32 inIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];

#ifdef OPT_BIN_RENDERER_V2
        Word16 shift_q;
#endif
        ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx );

        FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
@@ -2064,16 +2065,26 @@ void ivas_binRenderer_fx(

        ivas_binaural_reverb_processSubframe_fx( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx );

#ifdef OPT_BIN_RENDERER_V2
        shift_q = sub( Q6, sub( *Q_in, 1 ) );
#endif
        FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
        {
            FOR( j = 0; j < numTimeSlots; j++ )
            {
                FOR( k = 0; k < hBinRenderer->hReverb->numBins; k++ )
                {
#ifdef OPT_BIN_RENDERER_V2
                    reverbRe_fx[i][j][k] = L_shl( reverbRe_fx[i][j][k], shift_q ); // Q6
                    move32();
                    reverbIm_fx[i][j][k] = L_shl( reverbIm_fx[i][j][k], shift_q ); // Q6
                    move32();
#else
                    reverbRe_fx[i][j][k] = L_shl( reverbRe_fx[i][j][k], 1 ); //*Q_in
                    move32();
                    reverbIm_fx[i][j][k] = L_shl( reverbIm_fx[i][j][k], 1 ); //*Q_in
                    move32();
#endif
                }
            }
        }
@@ -2086,8 +2097,8 @@ void ivas_binRenderer_fx(
                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 ); // Q_in
                    v_add_32( Cldfb_ImagBuffer_Binaural_fx[pos_idx][chIdx][k], reverbIm_fx[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[pos_idx][chIdx][k], hBinRenderer->conv_band ); // Q_in
                    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
                    v_add_32( Cldfb_ImagBuffer_Binaural_fx[pos_idx][chIdx][k], reverbIm_fx[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[pos_idx][chIdx][k], hBinRenderer->conv_band ); // Q6
                }
            }
        }
@@ -2167,8 +2178,13 @@ void ivas_rend_CldfbMultiBinRendProcess(
                {
                    Copy32( &Cldfb_RealBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band );
                    Copy32( &Cldfb_ImagBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band );
#ifndef OPT_BIN_RENDERER_V2
                    Scale_sig32( &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q_in, Q_in_orig ) ); // Q_in_orig
                    Scale_sig32( &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q_in, Q_in_orig ) ); // Q_in_orig
#else
                    Scale_sig32( &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q_in, Q6 ) ); // Q_in
                    Scale_sig32( &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q_in, Q6 ) ); // Q_in
#endif
                }
            }
        }
+4 −2
Original line number Diff line number Diff line
@@ -4022,19 +4022,22 @@ void ivas_dirac_dec_render_sf_fx(
            }
        }

        /*Binaural output in Q6 format*/
        ivas_binRenderer_fx( st_ivas->hBinRenderer,
                             ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
                             st_ivas->hCombinedOrientationData,
                             hSpatParamRendCom->subframe_nbslots[subframe_idx],
                             Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx,
                             Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q );
#ifndef OPT_BIN_RENDERER_V2

        Word16 pos_idx;
#ifndef OPT_BIN_RENDERER_V2
        FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
        {
            Scale_sig32( &Cldfb_RealBuffer_Binaural_fx[pos_idx][0][0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); // Q6
            Scale_sig32( &Cldfb_ImagBuffer_Binaural_fx[pos_idx][0][0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); // Q6
        }
#endif
        IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
            FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
@@ -4049,7 +4052,6 @@ void ivas_dirac_dec_render_sf_fx(
                }
            }
        }
#endif /* OPT_BIN_RENDERER_V2 */

        /* Inverse CLDFB*/
        FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
+3 −3
Original line number Diff line number Diff line
@@ -2150,6 +2150,7 @@ void ivas_param_mc_dec_render_fx(
            }

            /* Implement binaural rendering */
            /*Binaural output in Q6 format*/
            ivas_binRenderer_fx( st_ivas->hBinRenderer,
                                 ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
                                 st_ivas->hCombinedOrientationData,
@@ -2170,8 +2171,8 @@ void ivas_param_mc_dec_render_fx(
                }
            }

            Word16 pos_idx;
#ifndef OPT_BIN_RENDERER_V2
            int16_t pos_idx;
            FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
            {
                FOR( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ )
@@ -2186,7 +2187,7 @@ void ivas_param_mc_dec_render_fx(
                    }
                }
            }

#endif /* OPT_BIN_RENDERER_V2 */
            IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
            {
                FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
@@ -2201,7 +2202,6 @@ void ivas_param_mc_dec_render_fx(
                    }
                }
            }
#endif /* OPT_BIN_RENDERER_V2 */
            /* update combined orientation access index */
            ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] );
        }
+4 −2
Original line number Diff line number Diff line
@@ -877,6 +877,7 @@ static void ivas_mc_paramupmix_dec_sf(
        }

        /* Implement binaural rendering */
        /*Binaural output in Q6 format*/
        ivas_binRenderer_fx( st_ivas->hBinRenderer,
                             ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
                             st_ivas->hCombinedOrientationData,
@@ -885,8 +886,8 @@ static void ivas_mc_paramupmix_dec_sf(
                             Cldfb_RealBuffer_subfr_fx,
                             Cldfb_ImagBuffer_subfr_fx, &input_q );

        Word16 pos_idx;
#ifndef OPT_BIN_RENDERER_V2
        int16_t pos_idx;
        FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
        {
            FOR( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ )
@@ -901,6 +902,7 @@ static void ivas_mc_paramupmix_dec_sf(
                }
            }
        }
#endif /* OPT_BIN_RENDERER_V2 */

        IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
@@ -917,7 +919,7 @@ static void ivas_mc_paramupmix_dec_sf(
            }
        }

#endif /* OPT_BIN_RENDERER_V2 */

        /* Implement CLDFB synthesis */
        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {