Commit fbbb2c24 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

SBA rotation BE optimization, FOA, HOA2 fix with crend

parent a2b85f9b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -203,7 +203,8 @@
/*CLDFB CODEC SWITCHES -- END*/

#define REND_STATIC_MEM_OPT
#define EUALER2QUAT_FIX
//#define EUALER2QUAT_FIX
#define SBA_CREND_ROT_OPT

#define ROM_TO_RAM                                      /*switch to convert CQMF decoder tables to RAM*/

+2 −0
Original line number Diff line number Diff line
@@ -948,9 +948,11 @@ ivas_error IVAS_DEC_FeedHeadTrackData(
    {
        /* check for Euler angle signaling */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifndef EUALER2QUAT_FIX
        /* TODO: temp change until Euler2Quat() is fixed*/
        if ( ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) &&
             ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
#endif
#endif
        {
            if ( orientation[i].w == -3.0f )
+40 −13
Original line number Diff line number Diff line
@@ -2422,37 +2422,41 @@ updateSbaPanGains(
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
                {
                    int16_t is_cldfb_in;
                    assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural mode is currently supported with HOA3 input and 48k sampling rate only" );

                    is_cldfb_in = 1;
                    ivas_renderSplitGetMultiBinPoseData(
                        &rendCtx.hhRendererConfig[0]->split_rend_config,
                        &inputSba->splitRendWrapper.multiBinPoseData,
                        rendCtx.pHeadRotData->sr_pose_pred_axis );
#ifdef SPLIT_REND_WITH_HEAD_ROT
                    if ( hRendCfg->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV )
#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT
                    if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV )

                    {
                        error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig,
                        assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" );
                        error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, hRendCfg,
                                                         &inputSba->splitRendWrapper.multiBinPoseData,
                                                         *rendCtx.pOutSampleRate );
                        if ( error != IVAS_ERR_OK )
                        {
                            return error;
                        }
                        is_cldfb_in = 0;
                        is_cldfb_in = 1;
                    }

                    else
#endif
                    {
                        error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, hRendCfg,
                        assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" );
                        error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig,
                                                             &inputSba->splitRendWrapper.multiBinPoseData,
                                                             *rendCtx.pOutSampleRate );
                        if ( error != IVAS_ERR_OK )
                        {
                            return error;
                        }
                        is_cldfb_in = 1;
                        is_cldfb_in = 0;
                    }

                    error = ivas_split_renderer_open( &inputSba->splitRendWrapper,
                                                      &inputSba->base.ctx.hhRendererConfig[0]->split_rend_config,
                                                      *rendCtx.pOutSampleRate, is_cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 );
@@ -2539,7 +2543,7 @@ static ivas_error setRendInputActiveSplitPostRend(
    outConfig = *rendCtx.pOutConfig;

#ifdef REND_STATIC_MEM_OPT
    if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK )
    if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) ) != IVAS_ERR_OK )
    {
        return error;
    }
@@ -2547,7 +2551,7 @@ static ivas_error setRendInputActiveSplitPostRend(
    initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx
#ifdef REND_STATIC_MEM_OPT
                       ,
                       inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH
                       inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS
#endif
    );

@@ -4539,7 +4543,11 @@ ivas_error IVAS_REND_SetHeadRotation(
                     ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ||
                     ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
                {
#ifndef EUALER2QUAT_FIX
                    rotQuat = headRot[i]; /* TODO: temp change until Euler2Quat() is fixed*/
#else
                    Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat );
#endif
                }
                else
#endif
@@ -4949,11 +4957,19 @@ static ivas_error rotateFrameSba(
    int16_t m1, m2;
    int16_t shd_rot_max_order;
    int16_t subframe_idx, subframe_len;
#ifdef SBA_CREND_ROT_OPT
    float *writePtr;
#else
    float *readPtr, *writePtr;
#endif
    rotation_matrix Rmat;
    float tmpRot[2 * HEADROT_ORDER + 1];
    rotation_gains gains;
    ivas_error error;
#ifdef SBA_CREND_ROT_OPT
    int16_t idx;
    float val, cf, oneminuscf;
#endif

    push_wmops( "rotateFrameSba" );

@@ -4980,6 +4996,11 @@ static ivas_error rotateFrameSba(

        for ( i = 0; i < subframe_len; i++ )
        {
#ifdef SBA_CREND_ROT_OPT
            idx = subframe_idx * subframe_len + i;
            cf = headRotData->crossfade[i];
            oneminuscf = 1 - cf;
#endif
            /*    As the rotation matrix becomes block diagonal in a SH basis, we can*/
            /*      apply each angular-momentum block individually to save complexity. */

@@ -4995,10 +5016,16 @@ static ivas_error rotateFrameSba(

                    for ( m = m1; m < m2; m++ )
                    {
#ifdef SBA_CREND_ROT_OPT
                        val = inAudio.data[m * inAudio.config.numSamplesPerChannel + idx];
                        /* crossfade with previous rotation gains */
                        tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val );
#else
                        readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i );
                        /* crossfade with previous rotation gains */
                        tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) +
                                          ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr );
#endif
                    }
                }
                /* write back the result */