Commit 18d64dd6 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Renderer functions conversion, cleanup and few MSAN error fixes

[x] Conversions related to ivas_mcmasa_ana.c added
[x] ivas dirac dec binaural functions converted, integrated and cleaned up.
[x] ivas_param_mc_dec_render clean up
[x] ivas_reflections.c file clean up
[x] Few MSAN issue fixes.
parent e15b792d
Loading
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
@@ -898,6 +898,63 @@ ivas_error ivas_dirac_sba_config(


#ifdef IVAS_FLOAT_FIXED
void computeDirectionVectors_fixed(
    Word32 *intensity_real_x,
    Word32 *intensity_real_y,
    Word32 *intensity_real_z,
    const Word16 enc_param_start_band,
    const Word16 num_frequency_bands,
    Word32 *direction_vector_x,/*Q30*/
    Word32 *direction_vector_y,/*Q30*/
    Word32 *direction_vector_z,/*Q30*/
    Word16 i_e /*Exponent of all the intensity buffers*/)
{
    Word16 i;
    Word32 intensityNorm;
    Word16 intensityNorm_e;
	Word32 temp1;
	Word16 exp1;
    Word16 norm_x, norm_y, norm_z;
    Word32 scaled_x, scaled_y, scaled_z;
    Word16 e_x, e_y, e_z;
    for ( i = enc_param_start_band; i < enc_param_start_band + num_frequency_bands; ++i )
    {
        norm_x = norm_l( *intensity_real_x );
        norm_y = norm_l( *intensity_real_y);
        norm_z = norm_l( *intensity_real_z );
        scaled_x = L_shl( *intensity_real_x, norm_x );
        scaled_y = L_shl( *intensity_real_y, norm_y);
        scaled_z = L_shl( *intensity_real_z, norm_z);
        e_x = i_e - norm_x;
        e_y = i_e - norm_y;
        e_z = i_e - norm_z;
        temp1 = BASOP_Util_Add_Mant32Exp( Mult_32_32( scaled_x, scaled_x ), 2*e_x, Mult_32_32( scaled_y, scaled_y ), 2*e_y, &exp1 );
        intensityNorm = BASOP_Util_Add_Mant32Exp( temp1, exp1, Mult_32_32( scaled_z, scaled_z ), 2 * e_z, &intensityNorm_e);

        IF ( LE_32(intensityNorm , EPSILON_FX) )
        {
            intensityNorm = L_shl(1, intensityNorm_e);
            *( direction_vector_x++ ) = ONE_IN_Q30;
            *( direction_vector_y++ ) = 0;
            *( direction_vector_z++ ) = 0;
            intensity_real_x++;
            intensity_real_y++;
            intensity_real_z++;
        }
        ELSE
        {
            intensityNorm = ISqrt32( intensityNorm, &intensityNorm_e ); /*Q31-intensityNorm_e*/
            *( direction_vector_x++ ) = L_shl(Mult_32_32(scaled_x , intensityNorm),e_x+ intensityNorm_e-1);/*Q30*/
            intensity_real_x++;
            *( direction_vector_y++ ) = L_shl(Mult_32_32( scaled_y, intensityNorm ), e_y+ intensityNorm_e-1);/*Q30*/
            intensity_real_y++;
            *( direction_vector_z++ ) = L_shl(Mult_32_32(scaled_z, intensityNorm), e_z + intensityNorm_e-1);/*Q30*/
            intensity_real_z++;
        }
    }

    return;
}
/*-------------------------------------------------------------------------
 * computeDirectionVectors()
 *
+21 −0
Original line number Diff line number Diff line
@@ -4421,6 +4421,16 @@ void computeDiffuseness_mdft(
    float *diffuseness 
);
#ifdef IVAS_FLOAT_FIXED
void computeDirectionVectors_fixed(
    Word32 *intensity_real_x,
    Word32 *intensity_real_y,
    Word32 *intensity_real_z,
    const Word16 enc_param_start_band,
    const Word16 num_frequency_bands,
    Word32 *direction_vector_x,/*Q30*/
    Word32 *direction_vector_y,/*Q30*/
    Word32 *direction_vector_z,/*Q30*/
    Word16 i_e /*Exponent of all the intensity buffers*/);
void computeDirectionVectors_fx(
    Word32 *intensity_real_x,
    Word32 *intensity_real_y,
@@ -4677,6 +4687,17 @@ void ivas_param_mc_dec_digest_tc_fx(
    Word32 *transport_channels_f_fx[],
    Word16 transport_f_e );

#ifdef IVAS_FLOAT_FIXED
void ivas_param_mc_dec_render_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                 */
    const UWord16 nSamplesAsked,                               /* i  : number of CLDFB slots requested                     */
    UWord16 *nSamplesRendered,                                 /* o  : number of CLDFB slots rendered                      */
    UWord16 *nSamplesAvailable,                                /* o  : number of CLDFB slots still to render               */
    Word32 *output_f_fx[],                                           /* o  : rendered time signal                                */
    Word16 channel_active_fx[MAX_OUTPUT_CHANNELS]
);
#endif

void ivas_param_mc_dec_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                 */
    const uint16_t nSamplesAsked,                               /* i  : number of CLDFB slots requested                     */
+6 −0
Original line number Diff line number Diff line
@@ -1054,6 +1054,12 @@ void v_multc_acc_32_16(
  Word32 y[],       /* o  : Output vector that contains y + c*x              */
  const Word16 N  /* i  : Vector length                                    */
);
void v_multc_acc_32_32(
    const Word32 x[], /* i  : Input vector                                     */
    const Word32 c,   /* i  : Constant                                         */
    Word32 y[],       /* o  : Output vector that contains y + c*x              */
    const Word16 N    /* i  : Vector length                                    */
);

void ivas_mono_stereo_downmix_mcmasa_fx(
  Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure                                          */
+1 −1
Original line number Diff line number Diff line
@@ -1219,7 +1219,7 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx(
    Word32 L_tmp;
    Word16 e_tmp;
    L_tmp = L_add( Mpy_32_32( dv[0], dv[0] ), Mpy_32_32( dv[1], dv[1] ) ); /* 2 * dv_q - 31 */
    e_tmp = shl( sub( 31, dv_q ), 2 );
    e_tmp = shl( sub( 31, dv_q ), 1 );
    L_tmp = Sqrt32( L_tmp, &e_tmp );
    *el = L_mult0( BASOP_util_atan2( dv[2], L_tmp, 31 - dv_q - e_tmp ), 29335 ); /* Q22 */
    *az = L_mult0( BASOP_util_atan2( dv[1], dv[0], 0 ), 29335 );                 /* Q22 */
+11 −0
Original line number Diff line number Diff line
@@ -3002,6 +3002,16 @@ void ivas_compute_spar_params_fx(
            Word16 q_tmp = hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx;
            IF( NE_16(ndm, 1 ))
            {
#ifdef MSAN_FIX
                FOR( i = 0; i < num_ch - ndm; i++ )
                {
                    FOR( int j = 0; j < ndm - 1; j++ )
                    {
                        hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr( hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub( q_tmp, 22 ) );
                        move32();
                    }
                }
#else
                for (i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++)
                {
                    for (int j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++)
@@ -3009,6 +3019,7 @@ void ivas_compute_spar_params_fx(
                        hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr(hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub(q_tmp, 22));
                    }
                }
#endif
                hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx = Q22;
            }

Loading