Commit a7252203 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

few more updates to split rendering BASOP

parent 3bd4f5e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -788,6 +788,7 @@ enum
#define CLDFB_NO_CHANNELS_MAX               60                     /* CLDFB resampling - max number of CLDFB channels, == IVAS_CLDFB_NO_CHANNELS_MAX */
#define CLDFB_NO_CHANNELS_MAX_FX            30720                  /*Q9*/ 
#define CLDFB_NO_COL_MAX                    16                     /* CLDFB resampling - max number of CLDFB col., == IVAS_CLDFB_NO_COL_MAX */
#define ONE_BY_CLDFB_NO_COL_MAX_Q31         134217728
#define CLDFB_NO_COL_MAX_SWITCH             6                      /* CLDFB resampling - max number of CLDFB col. for switching */
#define CLDFB_NO_COL_MAX_SWITCH_BFI         10                     /* CLDFB resampling - max number of CLDFB col. for switching, BFI */
#define CLDFB_OVRLP_MIN_SLOTS               3                      /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */
+20 −1
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ Word16 audioCfg2channels(
            move16();
            BREAK;
        case IVAS_AUDIO_CONFIG_BINAURAL:
#ifdef SPLIT_REND_WITH_HEAD_ROT
        case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
        case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
#endif
        case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
        case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
            nchan_out = 2;
@@ -266,6 +270,10 @@ void ivas_output_init(
                move16();
                BREAK;
            case IVAS_AUDIO_CONFIG_BINAURAL:
#ifdef SPLIT_REND_WITH_HEAD_ROT
            case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
            case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
#endif
            case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
            case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
            case IVAS_AUDIO_CONFIG_ISM1:
@@ -370,7 +378,12 @@ Word16 ivas_get_nchan_buffers_dec(
        {
            nchan_out_buff = s_max( nchan_out_buff, add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) );
        }
        ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
        ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#ifdef SPLIT_REND_WITH_HEAD_ROT
                 || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
                 EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
        )
        {
            nchan_out_buff = shl( CPE_CHANNELS, 1 );
        }
@@ -451,6 +464,12 @@ Word16 ivas_get_nchan_buffers_dec(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
    }
#endif

    return nchan_out_buff;
}
+27 −0
Original line number Diff line number Diff line
@@ -138,5 +138,32 @@ ivas_error ivas_render_config_init_from_rom_fx(
        move16();
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    ( *hRenderConfig )->split_rend_config.splitRendBitRate = SPLIT_REND_768k;
    move32();
    ( *hRenderConfig )->split_rend_config.dof = 3;
    move16();
    ( *hRenderConfig )->split_rend_config.hq_mode = 0;
    move16();
    ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0;
    move16();
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    ( *hRenderConfig )->split_rend_config.isar_frame_size_ms = 20;
    move16();
#endif
    ( *hRenderConfig )->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */
    move16();
    ( *hRenderConfig )->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
    move32();
    ( *hRenderConfig )->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB;
    move32();
    ( *hRenderConfig )->split_rend_config.rendererSelection = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT;
    move32();
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    ( *hRenderConfig )->split_rend_config.lc3plus_highres = 0;
    move16();
#endif
#endif

    return IVAS_ERR_OK;
}
+147 −44
Original line number Diff line number Diff line
@@ -88,6 +88,9 @@ Word16 square_root30_q12[31] = {
static ivas_error combine_external_and_head_orientations(
    IVAS_QUATERNION *headRotQuaternions,
    IVAS_VECTOR3 *listenerPos,
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i  : split rend pose prediction axis*/
#endif
    EXTERNAL_ORIENTATION_HANDLE hExtOrientationData,
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData );
static void external_target_interpolation_fx(
@@ -141,6 +144,10 @@ ivas_error ivas_headTrack_open_fx(
        move32();
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    ( *hHeadTrackData )->sr_pose_pred_axis = DEFAULT_AXIS;
    move32();
#endif

    set32_fx( ( *hHeadTrackData )->chEneIIR_fx[0], 0, MASA_FREQUENCY_BANDS );
    set32_fx( ( *hHeadTrackData )->chEneIIR_fx[1], 0, MASA_FREQUENCY_BANDS );
@@ -189,6 +196,18 @@ void QuatToRotMat_fx(
    Word32 Rmat[3][3]           /* o  : real-space rotation matrix for this rotation  2*Qx-32 */
)
{

#ifdef SPLIT_REND_WITH_HEAD_ROT
    IF( EQ_32( quat.w_fx, L_negate( 12582912 ) ) )
    {
        assert( 0 );
        // IVAS_QUATERNION quat_local;
        // Euler2Quat_fx( deg2rad( quat.x_fx ), deg2rad( quat.y_fx ), deg2rad( quat.z_fx ), &quat_local );
        // QuatToRotMat_fx( quat_local, Rmat );
    }
    else
    {
#endif
        Word32 w = quat.w_fx; // Qx
        move32();
        Word32 x = quat.x_fx;
@@ -234,7 +253,9 @@ void QuatToRotMat_fx(
        move32();
        Rmat[2][2] = L_add( L_sub( L_sub( ww, xx ), yy ), zz );
        move32();

#ifdef SPLIT_REND_WITH_HEAD_ROT
    }
#endif
    return;
}

@@ -711,8 +732,11 @@ void rotateFrame_shd(
    }

    /* calculate ambisonics rotation matrices for the previous and current frames */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev_fx[0], shd_rot_max_order );
#else
    SHrotmatgen_fx( SHrotmat_prev, hCombinedOrientationData->Rmat_prev_fx, shd_rot_max_order );

#endif
    SHrotmatgen_fx( SHrotmat /*Q14*/, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], shd_rot_max_order );

    FOR( i = 0; i < subframe_len; i++ )
@@ -773,7 +797,11 @@ void rotateFrame_shd(
    {
        MVR2R_WORD32(
            hCombinedOrientationData->Rmat_fx[subframe_idx][i],
#ifdef SPLIT_REND_WITH_HEAD_ROT
            hCombinedOrientationData->Rmat_prev_fx[0][i],
#else
            hCombinedOrientationData->Rmat_prev_fx[i],
#endif
            3 ); // Q14
    }

@@ -872,8 +900,11 @@ void rotateFrame_sd(
        }

        /* gains for previous subframe rotation */
#ifdef SPLIT_REND_WITH_HEAD_ROT
        rotateAziEle_fx( extract_l( L_shr( hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22 ) ), extract_l( L_shr( hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22 ) ), &azimuth, &elevation, hCombinedOrientationData->Rmat_prev_fx[0], hTransSetup.is_planar_setup );
#else
        rotateAziEle_fx( extract_l( L_shr( hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22 ) ), extract_l( L_shr( hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22 ) ), &azimuth, &elevation, hCombinedOrientationData->Rmat_prev_fx, hTransSetup.is_planar_setup );

#endif
        test();
        test();
        IF( hEFAPdata != NULL && ( NE_16( extract_l( L_shr( hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22 ) ), azimuth ) || NE_16( extract_l( L_shr( hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22 ) ), elevation ) ) )
@@ -967,7 +998,11 @@ void rotateFrame_sd(
    {
        MVR2R_WORD32(
            hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i], // Q30
#ifdef SPLIT_REND_WITH_HEAD_ROT
            hCombinedOrientationData->Rmat_prev_fx[0][i],
#else
            hCombinedOrientationData->Rmat_prev_fx[i],
#endif
            3 );
    }
    /* copy to output */
@@ -1311,6 +1346,9 @@ ivas_error ivas_combined_orientation_open(
    Word16 j;
    IVAS_QUATERNION identity;
    IVAS_VECTOR3 origo;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    Word16 pos_idx;
#endif
    identity.w_fx = ONE_IN_Q31;
    move32();
    identity.x_fx = 0;
@@ -1380,13 +1418,31 @@ ivas_error ivas_combined_orientation_open(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    FOR( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
    {
        FOR( j = 0; j < 3; j++ )
        {
            set32_fx( ( *hCombinedOrientationData )->Rmat_prev_fx[pos_idx][j], 0, 3 );
            ( *hCombinedOrientationData )->Rmat_prev_fx[pos_idx][j][j] = ONE_IN_Q30;
            move32();
        }
    }
    ( *hCombinedOrientationData )->sr_pose_pred_axis = DEFAULT_AXIS;
    ( *hCombinedOrientationData )->sr_low_res_flag = 0;
    move32();
    move16();
#else
    FOR( j = 0; j < 3; j++ )
    {
        set32_fx( ( *hCombinedOrientationData )->Rmat_prev_fx[j], 0, 3 );
        ( *hCombinedOrientationData )->Rmat_prev_fx[j][j] = ONE_IN_Q30;
        move32();
    }
    ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity;
#endif

    ( *hCombinedOrientationData )
        ->Quaternion_prev_extOrientation = identity;
    ( *hCombinedOrientationData )->Quaternion_frozen_ext = identity;
    ( *hCombinedOrientationData )->Quaternion_frozen_head = identity;
    set_zero_fx( ( *hCombinedOrientationData )->chEneIIR_fx[0], MASA_FREQUENCY_BANDS );
@@ -1447,6 +1503,9 @@ ivas_error combine_external_and_head_orientations_dec(
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle    */
)
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis;
#endif
    IVAS_QUATERNION *pHeadRotQuaternion = NULL;
    IVAS_VECTOR3 *listenerPos = NULL;

@@ -1454,8 +1513,20 @@ ivas_error combine_external_and_head_orientations_dec(
    {
        pHeadRotQuaternion = hHeadTrackData->Quaternions;
        listenerPos = hHeadTrackData->Pos;
#ifdef SPLIT_REND_WITH_HEAD_ROT
        sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis;
#endif
    }
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ELSE
    {
        sr_pose_pred_axis = DEFAULT_AXIS;
    }
#endif
    return combine_external_and_head_orientations( pHeadRotQuaternion, listenerPos,
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                   sr_pose_pred_axis,
#endif
                                                   hExtOrientationData, hCombinedOrientationData );
}

@@ -1472,10 +1543,17 @@ ivas_error combine_external_and_head_orientations_rend(
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle    */
)
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis;
#endif
    IVAS_QUATERNION *headRotQuaternions = NULL;
    IVAS_VECTOR3 *listenerPos = NULL;
    Word16 i;

#ifdef SPLIT_REND_WITH_HEAD_ROT
    sr_pose_pred_axis = DEFAULT_AXIS;
#endif

    IF( hHeadTrackData != NULL )
    {
        IF( hHeadTrackData->headRotEnabled )
@@ -1483,6 +1561,9 @@ ivas_error combine_external_and_head_orientations_rend(
            headRotQuaternions = hHeadTrackData->headPositions;
            listenerPos = hHeadTrackData->Pos;
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis;
#endif
    }
    ELSE IF( hExtOrientationData != NULL )
    {
@@ -1498,6 +1579,9 @@ ivas_error combine_external_and_head_orientations_rend(
    }

    return combine_external_and_head_orientations( headRotQuaternions, listenerPos,
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                   sr_pose_pred_axis,
#endif
                                                   hExtOrientationData, hCombinedOrientationData );
}

@@ -1511,6 +1595,9 @@ ivas_error combine_external_and_head_orientations_rend(
ivas_error combine_external_and_head_orientations(
    IVAS_QUATERNION *headRotQuaternions, /* i  : quaternions for head rotation                            */
    IVAS_VECTOR3 *listenerPos,           /* i  : listener position                                        */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i  : split rend pose prediction axis                          */
#endif
    EXTERNAL_ORIENTATION_HANDLE hExtOrientationData,     /* i  : external orientation handle                              */
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle                              */
)
@@ -1858,6 +1945,10 @@ ivas_error combine_external_and_head_orientations(
        hCombinedOrientationData->Quaternions[i].q_fact = add( hCombinedOrientationData->Quaternions[i].q_fact, l_shift );
        move16();
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    hCombinedOrientationData->sr_pose_pred_axis = sr_pose_pred_axis;
#endif
    return IVAS_ERR_OK;
}

@@ -2166,7 +2257,11 @@ static Word32 SHrot_w_fx(

    IF( m == 0 )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        assert( 0 && "ERROR should not be called\n" );
#else
        printf( "ERROR should not be called\n" );
#endif
        return 0;
    }
    ELSE
@@ -2366,7 +2461,11 @@ void ivas_combined_orientation_update_index(
    Word16 exp, div_result;
    IF( hCombinedOrientationData != NULL )
    {
        IF( EQ_16( hCombinedOrientationData->num_subframes, 1 ) )
        IF( EQ_16( hCombinedOrientationData->num_subframes, 1 )
#ifdef SPLIT_REND_WITH_HEAD_ROT
            || hCombinedOrientationData->sr_low_res_flag
#endif
        )
        {
            /* only one orientation available anyway or split rendering with low resolution*/
            hCombinedOrientationData->subframe_idx = 0;
@@ -2423,7 +2522,11 @@ void ivas_combined_orientation_update_start_index(
{
    IF( hCombinedOrientationData != NULL )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        IF( EQ_16( hCombinedOrientationData->num_subframes, 1 ) || hCombinedOrientationData->sr_low_res_flag )
#else
        IF( EQ_16( hCombinedOrientationData->num_subframes, 1 ) )
#endif
        {
            /* only one orientation available anyway or split rendering with low resolution*/
            hCombinedOrientationData->subframe_idx = 0;
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <math.h>
#include "ivas_prot_rend.h"
#include "ivas_stat_rend.h"
#include "ivas_prot_fx.h"
#include "ivas_cnst.h"
#include "prot.h"
#include "prot_fx.h"
Loading