Commit 41b819fd authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch 'ivas_split_rendering_basop_main' into kiene/add-split-rendering-ci-to-basop-sr-branch

parents efe6375a e731929c
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@
#include "wmc_auto.h"

#include "prot_fx.h"
#include "debug.h"

#define WMC_TOOL_SKIP

+4 −4
Original line number Diff line number Diff line
@@ -58,11 +58,11 @@ void Euler2Quat_fx(
)
{
    Word16 cr = getCosWord16( extract_l( L_shr_r( roll, 10 ) ) );           // Q14
    Word16 sr = getSinWord16( extract_l( L_shr_r( roll, 10 ) ) );
    Word16 sr = shr( getSinWord16( extract_l( L_shr_r( roll, 10 ) ) ), 1 ); // Q14
    Word16 cp = getCosWord16( extract_l( L_shr_r( pitch, 10 ) ) );
    Word16 sp = getSinWord16( extract_l( L_shr_r( pitch, 10 ) ) );
    Word16 sp = shr( getSinWord16( extract_l( L_shr_r( pitch, 10 ) ) ), 1 ); // Q14
    Word16 cy = getCosWord16( extract_l( L_shr_r( yaw, 10 ) ) );
    Word16 sy = getSinWord16( extract_l( L_shr_r( yaw, 10 ) ) );
    Word16 sy = shr( getSinWord16( extract_l( L_shr_r( yaw, 10 ) ) ), 1 );                                          // Q14
    quat->w_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( cr, cp ), cy ), Mpy_32_16_1( L_mult0( sr, sp ), sy ) ), 5 ); // Q22
    move32();
    quat->x_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( sr, cp ), cy ), Mpy_32_16_1( L_mult0( cr, sp ), sy ) ), 5 ); // Q22
+5 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "options.h"
#ifdef DEBUGGING
#include "debug.h"
#include <assert.h>
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
#include <sys/stat.h>
@@ -771,8 +772,10 @@ char *fname(
    const int16_t id,
    const int16_t enc_dec )
{
    char idd[5] = ".idX";
    idd[3] = (char) ( id + '0' );
    char idd[6];

    assert( id < 100 );
    sprintf( idd, ".id%d", id );

    strcpy( tmp_fname, dir );
    strcat( tmp_fname, file );
+18 −19
Original line number Diff line number Diff line
@@ -1228,7 +1228,7 @@ ivas_error ivas_rend_openCldfbRend(
    }

    /* Allocate memories and buffers needed for convolutional module in CICP19 */
    IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, 1, inConfig, pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ), IVAS_ERR_OK ) )
    IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, inConfig, pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ), IVAS_ERR_OK ) )
    {
        return error;
    }
@@ -1955,30 +1955,29 @@ void ivas_binRenderer_fx(
    {
        IF( GT_16( pMultiBinPoseData->num_poses, 1 ) )
        {
            IVAS_QUATERNION Quaternions_rel, Quaternions_abs, *Quaternions_ref;
            IVAS_QUATERNION Quaternions_abs, Quaternions_ref, Quaternions_ref2;
            Word32 Rmat_local[MAX_PARAM_SPATIAL_SUBFRAMES][3][3];
            Word16 q_fact_orig;

            IF( hCombinedOrientationData && hBinRenderer->rotInCldfb )
            {
                Quaternions_ref = &hCombinedOrientationData->Quaternions[0];
                Quaternions_rel.w_fx = L_negate( 12582912 ); // Q22
                Quaternions_abs.w_fx = L_negate( 12582912 ); // Q22
                q_fact_orig = Quaternions_ref->q_fact;
                Quaternions_ref = hCombinedOrientationData->Quaternions[0];
                q_fact_orig = Quaternions_ref.q_fact;

                modify_Quat_q_fx( Quaternions_ref, Quaternions_ref, Q22 );
                modify_Quat_q_fx( &Quaternions_ref, &Quaternions_ref, Q22 );

                Quaternions_ref2.w_fx = L_negate( 12582912 ); // Q22
                IF( EQ_16( hCombinedOrientationData->shd_rot_max_order, 0 ) )
                {
                    /*HOA signal already rotated by DirAC*/
                    Quaternions_abs.x_fx = 0;
                    Quaternions_abs.y_fx = 0;
                    Quaternions_abs.z_fx = 0;
                    Quaternions_ref2.x_fx = 0;
                    Quaternions_ref2.y_fx = 0;
                    Quaternions_ref2.z_fx = 0;
                }
                ELSE
                {
                    /*euler*/
                    Quat2EulerDegree_fx( *Quaternions_ref, &Quaternions_abs.z_fx, &Quaternions_abs.y_fx, &Quaternions_abs.x_fx ); /*order in Quat2Euler seems to be reversed ?*/
                    Quat2EulerDegree_fx( Quaternions_ref, &Quaternions_ref2.z_fx, &Quaternions_ref2.y_fx, &Quaternions_ref2.x_fx ); /*order in Quat2Euler seems to be reversed ?*/
                }

                FOR( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ )
@@ -1991,12 +1990,11 @@ void ivas_binRenderer_fx(
                            Copy32( ImagBuffer_local[chIdx][k], ImagBuffer_fx[chIdx][k], CLDFB_NO_CHANNELS_MAX );
                        }
                    }
                    Quaternions_rel.x_fx = L_sub( pMultiBinPoseData->relative_head_poses_fx[pos_idx][0], pMultiBinPoseData->relative_head_poses_fx[pos_idx - 1][0] );
                    Quaternions_rel.y_fx = L_sub( pMultiBinPoseData->relative_head_poses_fx[pos_idx][1], pMultiBinPoseData->relative_head_poses_fx[pos_idx - 1][1] );
                    Quaternions_rel.z_fx = L_sub( pMultiBinPoseData->relative_head_poses_fx[pos_idx][2], pMultiBinPoseData->relative_head_poses_fx[pos_idx - 1][2] );
                    Quaternions_abs.x_fx = L_add( Quaternions_abs.x_fx, Quaternions_rel.x_fx );
                    Quaternions_abs.y_fx = L_add( Quaternions_abs.y_fx, Quaternions_rel.y_fx );
                    Quaternions_abs.z_fx = L_add( Quaternions_abs.z_fx, Quaternions_rel.z_fx );

                    Quaternions_abs.x_fx = L_add( Quaternions_ref2.x_fx, pMultiBinPoseData->relative_head_poses_fx[pos_idx][0] );
                    Quaternions_abs.y_fx = L_add( Quaternions_ref2.y_fx, pMultiBinPoseData->relative_head_poses_fx[pos_idx][1] );
                    Quaternions_abs.z_fx = L_add( Quaternions_ref2.z_fx, pMultiBinPoseData->relative_head_poses_fx[pos_idx][2] );
                    Quaternions_abs.w_fx = L_negate( 12582912 ); // Q22

                    Euler2Quat_fx( deg2rad_fx( Quaternions_abs.x_fx ), deg2rad_fx( Quaternions_abs.y_fx ), deg2rad_fx( Quaternions_abs.z_fx ), &Quaternions_abs );

@@ -2129,11 +2127,12 @@ void ivas_rend_CldfbMultiBinRendProcess(
    Word32 Cldfb_ImagBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word16 Q_in_orig = Q_in;
    move16();
    Word16 Q_in_orig;

    FOR( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
    {
        Q_in_orig = Q_in;
        move16();
        FOR( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
        {
            idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx;
+9 −4
Original line number Diff line number Diff line
@@ -366,6 +366,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
    Word16 original_slots_rendered;
    Word32 *p_bin_output[BINAURAL_CHANNELS];
    Word32 output_local[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    Word16 q_fact_orig[MAX_PARAM_SPATIAL_SUBFRAMES];

    Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];

@@ -399,6 +400,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
    FOR( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i )
    {
        originalHeadRot[i] = st_ivas->hCombinedOrientationData->Quaternions[i];
        q_fact_orig[i] = originalHeadRot[i].q_fact;
    }

    original_subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
@@ -408,18 +410,20 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
    origTdRendHandle = st_ivas->hBinRendererTd;
    move32();

    FOR( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i )
    {
        modify_Quat_q_fx( &originalHeadRot[i], &originalHeadRot[i], Q22 );
    }

    FOR( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ )
    {
        /* Update head positions */
        IF( NE_16( pos_idx, 0 ) )
        {
            COMBINED_ORIENTATION_HANDLE pCombinedOrientationData = st_ivas->hCombinedOrientationData;
            Word16 q_fact_orig;
            FOR( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i )
            {
                pCombinedOrientationData->Quaternions[i].w_fx = L_negate( 12582912 ); // Q22
                q_fact_orig = originalHeadRot[i].q_fact;
                modify_Quat_q_fx( &originalHeadRot[i], &originalHeadRot[i], Q22 );
                /*euler*/
                Quat2EulerDegree_fx( originalHeadRot[i],
                                     &pCombinedOrientationData->Quaternions[i].z_fx,
@@ -433,7 +437,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
                               deg2rad_fx( pCombinedOrientationData->Quaternions[i].y_fx ),
                               deg2rad_fx( pCombinedOrientationData->Quaternions[i].z_fx ), &pCombinedOrientationData->Quaternions[i] );

                modify_Quat_q_fx( &pCombinedOrientationData->Quaternions[i], &pCombinedOrientationData->Quaternions[i], q_fact_orig );
                modify_Quat_q_fx( &pCombinedOrientationData->Quaternions[i], &pCombinedOrientationData->Quaternions[i], q_fact_orig[i] );
            }
        }

@@ -482,6 +486,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
    /* Restore original head rotation */
    FOR( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i )
    {
        modify_Quat_q_fx( &originalHeadRot[i], &originalHeadRot[i], q_fact_orig[i] );
        st_ivas->hCombinedOrientationData->Quaternions[i] = originalHeadRot[i];
        move32();
    }
Loading