Commit f0d09613 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fixes in quat shift, post renderer q fact saving

parent cc69948e
Loading
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -5961,9 +5961,8 @@ void modify_Quat_q_fx(
);

void modify_Rmat_q_fx(
    Word32 Rmat_in[MAX_PARAM_SPATIAL_SUBFRAMES][3][3],  /* i  : real-space rotation matrix for this rotation  */
    Word32 Rmat_out[MAX_PARAM_SPATIAL_SUBFRAMES][3][3], /* o  : real-space rotation matrix for this rotation*/
    Word16 num_subframes,
    Word32 Rmat_in[3][3],  /* i  : real-space rotation matrix for this rotation  */
    Word32 Rmat_out[3][3], /* o  : real-space rotation matrix for this rotation*/
    Word16 q_cur,          /* i  : current q factor for rotation  matrix            */
    Word16 q_new           /* i  : target q factor for rotation    matrix         */
);
+13 −17
Original line number Diff line number Diff line
@@ -116,10 +116,10 @@ void modify_Quat_q_fx(
    Word16 q_new                    /* i  : quaternion describing the rotation             */
)
{
    out_quat->w_fx = L_shl( in_quat->w_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->x_fx = L_shl( in_quat->x_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->y_fx = L_shl( in_quat->y_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->z_fx = L_shl( in_quat->z_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->w_fx = L_shl_sat( in_quat->w_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->x_fx = L_shl_sat( in_quat->x_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->y_fx = L_shl_sat( in_quat->y_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->z_fx = L_shl_sat( in_quat->z_fx, sub( q_new, in_quat->q_fact ) ); // q_new
    out_quat->q_fact = q_new;
    return;
}
@@ -130,26 +130,22 @@ void modify_Quat_q_fx(
 * Rotation matrix q factor modification
 *------------------------------------------------------------------------*/
void modify_Rmat_q_fx(
    Word32 Rmat_in[MAX_PARAM_SPATIAL_SUBFRAMES][3][3],  /* i  : real-space rotation matrix for this rotation  */
    Word32 Rmat_out[MAX_PARAM_SPATIAL_SUBFRAMES][3][3], /* o  : real-space rotation matrix for this rotation*/
    Word16 num_subframes,
    Word32 Rmat_in[3][3],  /* i  : real-space rotation matrix for this rotation  */
    Word32 Rmat_out[3][3], /* o  : real-space rotation matrix for this rotation*/
    Word16 q_cur,          /* i  : current q factor for rotation  matrix            */
    Word16 q_new           /* i  : target q factor for rotation    matrix         */
)
{
    Word16 i, j, k;
    Word16 j, k;

    FOR( i = 0; i < num_subframes; i++ )
    {
    FOR( j = 0; j < 3; j++ )
    {
        FOR( k = 0; k < 3; k++ )
        {
                Rmat_out[i][j][k] = L_shl( Rmat_in[i][j][k], sub( q_new, q_cur ) );
            Rmat_out[j][k] = L_shl( Rmat_in[j][k], sub( q_new, q_cur ) );
            move32();
        }
    }
    }
    return;
}

+5 −5
Original line number Diff line number Diff line
@@ -1956,7 +1956,7 @@ void ivas_binRenderer_fx(
        IF( GT_16( pMultiBinPoseData->num_poses, 1 ) )
        {
            IVAS_QUATERNION Quaternions_abs, Quaternions_ref, Quaternions_ref2;
            Word32 Rmat_local[MAX_PARAM_SPATIAL_SUBFRAMES][3][3];
            Word32 Rmat_local[3][3];
            Word16 q_fact_orig;

            IF( hCombinedOrientationData && hBinRenderer->rotInCldfb )
@@ -2000,17 +2000,17 @@ void ivas_binRenderer_fx(

                    modify_Quat_q_fx( &Quaternions_abs, &Quaternions_abs, q_fact_orig );

                    QuatToRotMat_fx( Quaternions_abs, Rmat_local[0] );
                    QuatToRotMat_fx( Quaternions_abs, Rmat_local );

                    modify_Rmat_q_fx( Rmat_local, Rmat_local, 1, sub( shl( q_fact_orig, 1 ), 32 ), Q30 );
                    modify_Rmat_q_fx( Rmat_local, Rmat_local, sub( shl( q_fact_orig, 1 ), 32 ), Q30 );

                    if ( hBinRenderer->hInputSetup->is_loudspeaker_setup )
                    {
                        rotateFrame_sd_cldfb_fixed( Rmat_local[0], RealBuffer_fx, ImagBuffer_fx, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band );
                        rotateFrame_sd_cldfb_fixed( Rmat_local, RealBuffer_fx, ImagBuffer_fx, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band );
                    }
                    else
                    {
                        rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local[0], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 );
                        rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 );
                    }

                    FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
+1 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ typedef struct
    ISAR_BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec;
    int16_t first_good_frame_received;
    ISAR_LC3PLUS_DEC_HANDLE hLc3plusDec;
    Word16 Q_last;

} ISAR_SPLIT_POST_REND_WRAPPER;

+5 −3
Original line number Diff line number Diff line
@@ -1486,6 +1486,7 @@ static ivas_error renderSplitBinauralWithPostRot(
                    {
                        isar_splitBinLCLDDecProcess( hSplitBin->hSplitBinLCLDDec, &bits, Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, &Q_cldfb_final[sf_idx], SplitRendBFI ); // Q_cldfb_final

                        hSplitBin->Q_last = Q_cldfb_final[sf_idx];
                        /* copy data over to 5ms buffer */
                        FOR( chnlIdx = 0; chnlIdx < BINAURAL_CHANNELS; ++chnlIdx )
                        {
@@ -1526,6 +1527,7 @@ static ivas_error renderSplitBinauralWithPostRot(
                        {
                            return error;
                        }
                        hSplitBin->Q_last = Q_out[sf_idx][0];

                        /* cache the remaining 15ms */
                        splitBinInput->numCachedSamples = numSamplesPerChannelCacheSize;
@@ -1540,7 +1542,7 @@ static ivas_error renderSplitBinauralWithPostRot(
                    {
                        Word16 readOffset = sub( numColPerChannelCacheSize, splitBinInput->numCachedSamples );
                        readPtr_fx = splitBinInput->bufferData_fx;
                        Q_cldfb_final[sf_idx] = Q_cldfb_final[sf_idx - 1];
                        Q_cldfb_final[sf_idx] = hSplitBin->Q_last;
                        isPostRendInputCldfb = 1;

                        readPtr_fx += 2 * readOffset * CLDFB_NO_CHANNELS_MAX * BINAURAL_CHANNELS;
@@ -1566,8 +1568,8 @@ static ivas_error renderSplitBinauralWithPostRot(
                        Word16 readOffset = numSamplesPerChannelCacheSize - splitBinInput->numCachedSamples;
                        mvl2l( splitBinInput->bufferData_fx + readOffset, &tmpCrendBuffer_fx[0][sf_idx * outBufNumSamplesPerChannel], outBufNumSamplesPerChannel );
                        mvl2l( splitBinInput->bufferData_fx + readOffset + numSamplesPerChannelCacheSize, &tmpCrendBuffer_fx[1][sf_idx * outBufNumSamplesPerChannel], outBufNumSamplesPerChannel );
                        Q_out[sf_idx][0] = Q_out[sf_idx - 1][0];
                        Q_out[sf_idx][1] = Q_out[sf_idx - 1][1];
                        Q_out[sf_idx][0] = hSplitBin->Q_last;
                        Q_out[sf_idx][1] = hSplitBin->Q_last;
                        splitBinInput->numCachedSamples -= outBufNumSamplesPerChannel;
                    }
                }
Loading