Commit 1b43fa8c authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_867_CLDFB_NRG_SCALE, FIX_1737_FIX_867_CLDFB_NRG_SCALE

parent 2728e20f
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -788,9 +788,7 @@ enum
#define L_HP20_MEM                          4                      /* HP20 filter memory length */

#define CLDFB_NO_CHANNELS_MAX               60                     /* CLDFB resampling - max number of CLDFB channels, == IVAS_CLDFB_NO_CHANNELS_MAX */
#ifdef FIX_867_CLDFB_NRG_SCALE
#define CLDFB_NO_CHANNELS_HALF              30                     /* CLDFB resampling - max number of CLDFB channels, == IVAS_CLDFB_NO_CHANNELS_MAX */
#endif
#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 CLDFB_NO_COL_MAX_LOG2               4                      /* To be used for shift operation instead of division */
+0 −2
Original line number Diff line number Diff line
@@ -71,8 +71,6 @@
#define BASOP_NOGLOB_DECLARE_LOCAL
#endif

#define FIX_867_CLDFB_NRG_SCALE
#define FIX_1737_FIX_867_CLDFB_NRG_SCALE
#define FIX_1737_proto_fac_overflow


+0 −171
Original line number Diff line number Diff line
@@ -2332,12 +2332,8 @@ void ivas_dirac_dec_render_sf_fx(
    DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params;
    DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state;
    Word16 num_channels_dir, exp;
#ifdef FIX_867_CLDFB_NRG_SCALE
    Word16 q_diffuseness_vector = Q31, q_reference_power_smooth[2] = { Q31, Q31 };
    move16();
#else
    Word16 q_diffuseness_vector = Q31, q_reference_power_smooth = Q31;
#endif
    move16();
    move16();
    Word16 proto_power_smooth_len = 0;
@@ -2588,7 +2584,6 @@ void ivas_dirac_dec_render_sf_fx(
        scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, imult1616( hSpatParamRendCom->num_freq_bands, hDirACRend->hOutSetup.nchan_out_woLFE ), tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev+ tmp1)
        hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, tmp1 );
        move16();
#ifdef FIX_867_CLDFB_NRG_SCALE
        tmp1 = 31;
        move16();
        FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) )
@@ -2613,12 +2608,6 @@ void ivas_dirac_dec_render_sf_fx(
        }
        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], tmp1 );
        move16();
#else
        tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) );
        scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q tmp1)
        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, tmp1 );
        move16();
#endif
        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 )
        {
            tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, imult1616( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) );
@@ -2940,11 +2929,7 @@ void ivas_dirac_dec_render_sf_fx(
                                               &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q,
                                               hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx,
                                               &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                               reference_power_fx, DirAC_mem.reference_power_q,
#else
                                               reference_power_fx, &DirAC_mem.reference_power_q,
#endif
                                               slot_idx, nchan_transport,
                                               hDirACRend->num_outputs_diff,
                                               hSpatParamRendCom->num_freq_bands,
@@ -2957,11 +2942,7 @@ void ivas_dirac_dec_render_sf_fx(
                                               &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q,
                                               hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx,
                                               &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                               reference_power_fx, DirAC_mem.reference_power_q,
#else
                                               reference_power_fx, &DirAC_mem.reference_power_q,
#endif
                                               slot_idx, nchan_transport,
                                               hDirACRend->num_outputs_diff,
                                               hSpatParamRendCom->num_freq_bands,
@@ -2980,17 +2961,9 @@ void ivas_dirac_dec_render_sf_fx(
                                        hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx,
                                        &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q,
                                        reference_power_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                        DirAC_mem.reference_power_q,
#else
                                        &DirAC_mem.reference_power_q,
#endif
                                        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#else
                                        &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#endif
                                        0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect,
                                        q_cldfb );

@@ -3014,17 +2987,9 @@ void ivas_dirac_dec_render_sf_fx(
                                                hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx,
                                                &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q,
                                                reference_power_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                DirAC_mem.reference_power_q,
#else
                                                &DirAC_mem.reference_power_q,
#endif
                                                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#else
                                                &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#endif
                                                slot_idx, hDirACRend->num_outputs_diff,
                                                hSpatParamRendCom->num_freq_bands,
                                                hDirACRend->hoa_decoder,
@@ -3039,17 +3004,9 @@ void ivas_dirac_dec_render_sf_fx(
                                                hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx,
                                                &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q,
                                                reference_power_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                DirAC_mem.reference_power_q,
#else
                                                &DirAC_mem.reference_power_q,
#endif
                                                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#else
                                                &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#endif
                                                hDirACRend->hOutSetup.is_loudspeaker_setup,
                                                slot_idx,
                                                hSpatParamRendCom->num_freq_bands,
@@ -3072,17 +3029,9 @@ void ivas_dirac_dec_render_sf_fx(
                                                hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx,
                                                &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q,
                                                reference_power_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                DirAC_mem.reference_power_q,
#else
                                                &DirAC_mem.reference_power_q,
#endif
                                                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#else
                                                &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q,
#endif
                                                slot_idx,
                                                hDirACRend->num_protos_diff,
                                                hSpatParamRendCom->num_freq_bands, q_cldfb );
@@ -3145,12 +3094,8 @@ void ivas_dirac_dec_render_sf_fx(
                                       num_freq_bands, azimuth, elevation );

            Copy32( reference_power_fx, &( hDirACRend->buffer_energy_fx[i_mult( sub( index, 1 ), num_freq_bands )] ), num_freq_bands );
#ifdef FIX_867_CLDFB_NRG_SCALE
            Scale_sig32( &( hDirACRend->buffer_energy_fx[add( i_mult( sub( index, 1 ), num_freq_bands ), CLDFB_NO_CHANNELS_HALF )] ), s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_q[1] ) );
            hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q[0];
#else
            hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q;
#endif
            move16();

            computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector );
@@ -3356,7 +3301,6 @@ void ivas_dirac_dec_render_sf_fx(

        IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
        {
#ifdef FIX_867_CLDFB_NRG_SCALE
            v_add_fixed_me( reference_power_fx, sub( 31, DirAC_mem.reference_power_q[0] ),
                            reference_power_smooth_fx, sub( 31, q_reference_power_smooth[0] ),
                            reference_power_smooth_fx, &temp_q,
@@ -3367,50 +3311,6 @@ void ivas_dirac_dec_render_sf_fx(
                            reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q,
                            s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 );
            q_reference_power_smooth[1] = sub( 31, temp_q );
#else
            IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) )
            {
                Word32 temp;
                FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
                {
                    temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth, DirAC_mem.reference_power_q ) );
                    test();
                    IF( temp == 0 && ( reference_power_fx[i] != 0 ) )
                    {
                        reference_power_fx[i] = 1;
                    }
                    ELSE
                    {
                        reference_power_fx[i] = temp;
                    }
                    move32();
                }
                DirAC_mem.reference_power_q = q_reference_power_smooth;
                move16();
            }
            ELSE
            {
                Word32 temp;
                FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
                {
                    temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q, q_reference_power_smooth ) );
                    test();
                    IF( temp == 0 && ( reference_power_smooth_fx[i] != 0 ) )
                    {
                        reference_power_smooth_fx[i] = 1;
                    }
                    ELSE
                    {
                        reference_power_smooth_fx[i] = temp;
                    }
                    move32();
                }
                q_reference_power_smooth = DirAC_mem.reference_power_q;
                move16();
            }
            v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 );
            q_reference_power_smooth = sub( q_reference_power_smooth, 1 );
#endif
        }
    }

@@ -3609,7 +3509,6 @@ void ivas_dirac_dec_render_sf_fx(
            Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, i_mult( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ), sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q ) ); // Q31
        }

#ifdef FIX_867_CLDFB_NRG_SCALE
        exp = L_norm_arr( reference_power_smooth_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) );
        scale_sig32( reference_power_smooth_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // q_reference_power_smooth[0] + exp
        q_reference_power_smooth[0] = add( q_reference_power_smooth[0], exp );
@@ -3653,38 +3552,6 @@ void ivas_dirac_dec_render_sf_fx(
            q_reference_power_smooth[1] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1];
            move16();
        }
#else
        exp = L_norm_arr( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands );
        scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, exp ); // q_reference_power_smooth + exp
        q_reference_power_smooth = add( q_reference_power_smooth, exp );
        IF( LT_16( q_reference_power_smooth, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) )
        {
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hSpatParamRendCom->num_freq_bands, sub( q_reference_power_smooth, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) ); // q_reference_power_smooth
            hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = q_reference_power_smooth;
            move16();
        }
        ELSE
        {
            Word32 temp;
            FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
            {
                temp = L_shl( reference_power_smooth_fx[i], sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, q_reference_power_smooth ) );
                test();
                IF( temp == 0 && ( reference_power_smooth_fx[i] != 0 ) )
                {
                    reference_power_smooth_fx[i] = 1;
                }
                ELSE
                {
                    reference_power_smooth_fx[i] = temp;
                }
                move32();
            }

            q_reference_power_smooth = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q;
            move16();
        }
#endif

        IF( hDirACRend->masa_stereo_type_detect != NULL )
        {
@@ -3704,7 +3571,6 @@ void ivas_dirac_dec_render_sf_fx(
            }
        }

#ifdef FIX_867_CLDFB_NRG_SCALE
        exp = 31;
        move16();
        FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) )
@@ -3766,24 +3632,6 @@ void ivas_dirac_dec_render_sf_fx(
            hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1];
            move16();
        }
#else
        exp = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, proto_power_smooth_len );
        scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, proto_power_smooth_len, exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp)
        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, exp );
        move16();
        IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) )
        {
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, i_mult( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) ); // proto_power_smooth_q
            hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q;
            move16();
        }
        ELSE
        {
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, i_mult( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) ); // proto_power_smooth_prev_q
            hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q;
            move16();
        }
#endif

        exp = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) );
        scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q + exp)
@@ -3827,16 +3675,11 @@ void ivas_dirac_dec_render_sf_fx(
                                                                    hSpatParamRendCom->subframe_nbslots[subframe_idx],
                                                                    diffuseness_vector_fx,
                                                                    reference_power_smooth_fx,
#ifdef FIX_867_CLDFB_NRG_SCALE
                                                                    q_reference_power_smooth,
#else
                                                                    &q_reference_power_smooth,
#endif
                                                                    qualityBasedSmFactor_fx,
                                                                    hDirAC->hConfig->enc_param_start_band,
                                                                    &q_Cldfb );

#ifdef FIX_867_CLDFB_NRG_SCALE
        Word16 allZero = 1;
        move16();
        FOR( i = 0; i < proto_power_smooth_len; i++ )
@@ -3857,20 +3700,6 @@ void ivas_dirac_dec_render_sf_fx(
            hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = 31;
            move16();
        }
#else
        Word16 sh = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q;
        move16();
        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = 31;
        move16();
        FOR( i = 0; i < proto_power_smooth_len; i++ )
        {
            IF( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx[i] != 0 )
            {
                hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = sh;
                move16();
            }
        }
#endif

        FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ )
        {
+0 −239

File changed.

Preview size limit exceeded, changes collapsed.

+0 −593

File changed.

Preview size limit exceeded, changes collapsed.

Loading