Commit 078b3c42 authored by vaclav's avatar vaclav
Browse files

harmonize name and comment of "hodirac_flag"

parent 81c68191
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -2944,7 +2944,7 @@ ivas_error ivas_qmetadata_enc_encode(
    IVAS_QMETADATA *hQMetaData                                  /* i/o: q_metadata handle                       */
#ifdef HODIRAC
    ,
    int16_t hodirac /* i: flag to indicate sector processing */
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode           */
#endif
);

@@ -3020,7 +3020,7 @@ int16_t ivas_qmetadata_dec_decode(
    int16_t *index                                              /* i/o: bitstream position                      */
#ifdef HODIRAC
    ,
    int16_t hodirac                                             /* i: flag to indicate sector processing */
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode           */
#endif
);

@@ -3248,7 +3248,7 @@ void ivas_dirac_param_est_enc(
    const SBA_MODE sba_mode
#ifdef HODIRAC
    ,
   const int16_t hodirac,
   const int16_t hodirac_flag,
   const int16_t nchan_fb_in
#endif
 );
@@ -3586,7 +3586,6 @@ void ivas_dirac_dec_decorr_close(
    HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state 
);


ivas_error  ivas_dirac_dec_output_synthesis_open(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                               */
@@ -3594,7 +3593,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open(
    const int32_t output_Fs                                     /* i  : output sampling rate                        */
#ifdef HODIRAC
	,
    const int16_t hodirac          /* i : flag to indicate HO-DirAC mode*/
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode               */
#endif
);

@@ -3603,7 +3602,7 @@ void ivas_dirac_dec_output_synthesis_init(
    const int16_t nchan_out_woLFE                               /* i  : number of output audio channels without LFE */
#ifdef HODIRAC
    ,
    const int16_t hodirac          /* flag to indicate HO-DirAC mode */
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode               */
#endif
);

@@ -3621,9 +3620,8 @@ void ivas_dirac_dec_output_synthesis_process_slot(
	const int16_t nchan_transport,                              /* i  : number of transport channels                */
#ifndef HODIRAC
	const int16_t index_slot 
#endif
#ifdef HODIRAC
    const int16_t hodirac
#else
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode               */
#endif
);

@@ -3635,7 +3633,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
    const float *onset_filter 
#ifdef HODIRAC                                                      
    ,
    const int16_t hodirac                                       /* i: flag for sector-based processing */
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode               */
#endif
);

@@ -3686,7 +3684,7 @@ void ivas_dirac_dec_compute_directional_responses(
    const float *p_Rmat                                         /* i  : rotation matrix                                 */
#ifdef HODIRAC
    ,
    const int16_t hodirac                                       /* i  : flag for sector based dirac processing */
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode                   */
#endif
);

@@ -4770,7 +4768,7 @@ void masa_compensate_two_dir_energy_ratio_index(
    int16_t *ratio_index_mod2                                   /* o  : Output modified ratio for direction 2           */
#ifdef HODIRAC
    ,
    int16_t hodirac                                             /* i: flag to indicate sector processing */
    const int16_t hodirac_flag                                  /* i : flag to indicate HO-DirAC mode                   */
#endif
);

@@ -4782,7 +4780,7 @@ void ivas_set_qmetadata_maxbit_req(
#ifdef HODIRAC
/*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */
int16_t ivas_get_df_ratio_bits_hodirac(
    int16_t index_diff                                          /* i  : Index of quantized diffuse-to-total ratio       */
    const int16_t index_diff                                    /* i  : Index of quantized diffuse-to-total ratio       */
);
#endif

+10 −3
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ void masa_compensate_two_dir_energy_ratio_index(
    int16_t *ratio_index_mod2    /* o  : Output modified ratio for direction 2 */
#ifdef HODIRAC
    ,
    int16_t hodirac /* i: flag to indicate sector processing */
    const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode         */
#endif
)
{
@@ -523,7 +523,7 @@ void masa_compensate_two_dir_energy_ratio_index(
    ratio2 = 1.0f - diffuseness_reconstructions[ratio_index_2];

#ifdef HODIRAC
    if ( !hodirac )
    if ( !hodirac_flag )
#endif
    {
#ifdef HODIRAC
@@ -626,10 +626,17 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation(
    return;
}


#ifdef HODIRAC
/*-------------------------------------------------------------------------
 * ivas_get_df_ratio_bits_hodirac()
 *
 * 
 *------------------------------------------------------------------------*/

/*! r: bits to be used for quantizing ratio of ratios */
int16_t ivas_get_df_ratio_bits_hodirac(
    int16_t index_diff /* i  : index of quantized diffuse-to-total ratio */
    const int16_t index_diff /* i  : index of quantized diffuse-to-total ratio */
)
{
    int16_t dfRatio_bits;
+11 −12
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@
static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem
#ifdef HODIRAC
                                        ,
                                        int16_t hodirac
                                        const int16_t hodirac_flag
#endif
);

@@ -155,7 +155,6 @@ ivas_error ivas_dirac_dec_config(
    hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order );
#endif


    if ( flag_config == DIRAC_RECONFIGURE )
    {
        hDirAC = st_ivas->hDirAC;
@@ -1510,7 +1509,7 @@ static ivas_error ivas_dirac_alloc_mem(
    DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem
#ifdef HODIRAC
    ,
    int16_t hodirac
    const int16_t hodirac_flag
#endif
)
{
@@ -1532,7 +1531,7 @@ static ivas_error ivas_dirac_alloc_mem(

    size = num_freq_bands * num_outputs_dir;
#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        size_ho = size * DIRAC_HO_NUMSECTORS;
        size_pf = num_freq_bands * DIRAC_HO_NUMSECTORS;
@@ -1810,7 +1809,7 @@ void ivas_dirac_dec_read_BS(
    int16_t *nb_bits,                 /* o  : number of bits read         */
    const SBA_MODE sba_mode,          /* i  : SBA mode                    */
#ifdef HODIRAC
    const int16_t hodirac, /* i : HO-Dirac flag */
    const int16_t hodirac_flag, /* i : HO-Dirac flag */
#endif
    int16_t *dirac_to_spar_md_bands /* o  : DirAC->SPAR MD bands        */
)
@@ -1910,7 +1909,7 @@ void ivas_dirac_dec_read_BS(
            *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos )
#ifdef HODIRAC
                                                                                   ,
                                                   hodirac
                                                   hodirac_flag
#endif
            );
        }
@@ -1982,7 +1981,7 @@ void ivas_dirac_dec_read_BS(
        ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, sba_mode
#ifdef HODIRAC
                                 ,
                                 hodirac
                                 hodirac_flag
#endif
                                 ,
                                 dirac_to_spar_md_bands );
@@ -2005,7 +2004,7 @@ void ivas_qmetadata_to_dirac(
    const int32_t ivas_total_brate,         /* i  : IVAS total bitrate       */
    const SBA_MODE sba_mode,                /* i  : SBA mode                 */
#ifdef HODIRAC
    const int16_t hodirac, /* i : HO-DirAC flag*/
    const int16_t hodirac_flag, /* i : HO-DirAC flag*/
#endif
    int16_t *dirac_to_spar_md_bands /* o  : DirAC->SPAR MD bands     */
)
@@ -2219,7 +2218,7 @@ void ivas_qmetadata_to_dirac(

        /* Bands with spatial data transmitted */
#ifdef HODIRAC
        if ( hodirac )
        if ( hodirac_flag )
        {
            no_secs = DIRAC_HO_NUMSECTORS;
        }
@@ -2270,7 +2269,7 @@ void ivas_qmetadata_to_dirac(


#ifdef HODIRAC
                    if ( hMasa == NULL && hodirac )
                    if ( hMasa == NULL && hodirac_flag )
                    {
                        azimuth = q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata];
                        elevation = q_direction[idx_sec].band_data[qBand_idx].elevation[block_qmetadata];
@@ -2306,7 +2305,7 @@ void ivas_qmetadata_to_dirac(
                        tmp_write_idx_band = tmp_write_idx_param_band;

#ifdef HODIRAC
                        if ( hodirac )
                        if ( hodirac_flag )
                        {
                            azi = (int16_t) ( azimuth + 0.5f );
                            ele = (int16_t) ( elevation + 0.5f );
@@ -2348,7 +2347,7 @@ void ivas_qmetadata_to_dirac(
                            hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness;

#ifdef HODIRAC
                            if ( hodirac )
                            if ( hodirac_flag )
                            {
                                if ( idx_sec == 0 )
                                {
+36 −47
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open(
    const int32_t output_Fs        /* i  : output sampling rate        */
#ifdef HODIRAC
    ,
    const int16_t hodirac /* i : flag to indicate HO-DirAC mode*/
    const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode*/
#endif
)
{
@@ -175,7 +175,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open(

    /* target PSD buffers */
#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS;
    }
@@ -377,7 +377,7 @@ void ivas_dirac_dec_output_synthesis_init(
    const int16_t nchan_out_woLFE /* i  : number of output audio channels without LFE */
#ifdef HODIRAC
    ,
    const int16_t hodirac /* flag to indicate HO-DirAC mode */
    const int16_t hodirac_flag /* flag to indicate HO-DirAC mode */
#endif
)
{
@@ -402,7 +402,7 @@ void ivas_dirac_dec_output_synthesis_init(
    }

#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS;
    }
@@ -572,9 +572,8 @@ void ivas_dirac_dec_output_synthesis_process_slot(
    const int16_t nchan_transport,     /* i  : number of transport channels*/
#ifndef HODIRAC
    const int16_t index_slot
#endif
#ifdef HODIRAC
    const int16_t hodirac
#else
    const int16_t hodirac_flag                                                                        /* i : flag to indicate HO-DirAC mode*/
#endif
)
{
@@ -609,37 +608,24 @@ void ivas_dirac_dec_output_synthesis_process_slot(
    }

#ifdef HODIRAC
    if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac )
    if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag )
    {
        ivas_dirac_dec_compute_directional_responses( hDirAC,
                                                      hVBAPdata,
                                                      NULL,
                                                      NULL,
                                                      2,
                                                      p_Rmat,
                                                      hodirac );
        ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, NULL, 2, p_Rmat, hodirac_flag );
    }
    if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac )

    if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag )
    {
        if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD )
        {
            v_multc( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands );
            v_addc( aux_buf, 1.f, aux_buf, num_freq_bands );
            mvr2r( hDirAC->energy_ratio1[hDirAC->dirac_read_idx],
                   h_dirac_output_synthesis_state->direct_power_factor,
                   num_freq_bands );
            mvr2r( aux_buf,
                   h_dirac_output_synthesis_state->diffuse_power_factor,
                   num_freq_bands );
            mvr2r( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], h_dirac_output_synthesis_state->direct_power_factor, num_freq_bands );
            mvr2r( aux_buf, h_dirac_output_synthesis_state->diffuse_power_factor, num_freq_bands );

            v_multc( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands );
            v_addc( aux_buf, 1.f, aux_buf, num_freq_bands );
            mvr2r( hDirAC->energy_ratio2[hDirAC->dirac_read_idx],
                   &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands],
                   num_freq_bands );
            mvr2r( aux_buf,
                   &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands],
                   num_freq_bands );
            mvr2r( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], num_freq_bands );
            mvr2r( aux_buf, &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], num_freq_bands );
        }
        else
        {
@@ -805,7 +791,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
    const float *onset_filter
#ifdef HODIRAC
    ,
    const int16_t hodirac /* i: flag for sector-based processing */
    const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode*/
#endif
)
{
@@ -854,7 +840,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
     *-----------------------------------------------------------------*/

#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        assert( hDirAC->hConfig->dec_param_estim == FALSE );
        /*Direct gain*/
@@ -957,7 +943,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(

    /*Direct gains*/
#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ )
        {
@@ -1002,8 +988,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
            *( p_gains_dir++ ) = g2;
        }
    }

#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        // wkr: additional gains for second sector, hard coded to two sectors
        p_cy_cross_dir_smooth = h_dirac_output_synthesis_state.cy_cross_dir_smooth + num_freq_bands * num_channels_dir;
@@ -1035,7 +1022,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
    }
#endif


    /*Diffuse gains*/
    p_cy_auto_diff_smooth = h_dirac_output_synthesis_state.cy_auto_diff_smooth + nchan_transport_foa * num_freq_bands_diff;
    p_gains_diff = h_dirac_output_synthesis_state.cy_auto_diff_smooth_prev + nchan_transport_foa * num_freq_bands_diff;
@@ -1079,7 +1065,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
        for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_dir; ch_idx++ )
        {
#ifdef HODIRAC
            if ( hodirac )
            if ( hodirac_flag )
            {
                if ( proto_direct_index[ch_idx] == 0 )
                {
@@ -1236,7 +1222,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(

    /* store estimates for next synthesis block */
#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        mvr2r( h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev, h_dirac_output_synthesis_state.gains_dir_prev, num_freq_bands * num_channels_dir * DIRAC_HO_NUMSECTORS );
    }
@@ -1250,7 +1236,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(

    /* reset values */
#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        set_zero( h_dirac_output_synthesis_state.cy_cross_dir_smooth, num_freq_bands * num_channels_dir * DIRAC_HO_NUMSECTORS );
    }
@@ -1260,7 +1246,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd(
        set_zero( h_dirac_output_synthesis_state.cy_cross_dir_smooth, num_freq_bands * num_channels_dir );
    }


    set_zero( h_dirac_output_synthesis_state.cy_auto_diff_smooth, num_freq_bands_diff * num_channels_diff );

    return;
@@ -1795,7 +1780,7 @@ void ivas_dirac_dec_compute_directional_responses(
    const float *p_Rmat              /* i  : rotation matrix                */
#ifdef HODIRAC
    ,
    const int16_t hodirac /* i  : flag for sector based dirac processing */
    const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode*/
#endif
)
{
@@ -1868,10 +1853,12 @@ void ivas_dirac_dec_compute_directional_responses(
#ifdef HODIRAC
                set_f( direct_response_hoa, 1.0f, MAX_OUTPUT_CHANNELS );
                set_f( direct_response_dir2, 1.0f, MAX_OUTPUT_CHANNELS );

                if ( p_Rmat != 0 )
                {
                    ivas_dirac_dec_get_response_split_order( azimuth[k], elevation[k], direct_response_hoa, shd_rot_max_order, p_Rmat );
                    if ( hodirac )

                    if ( hodirac_flag )
                    {
                        ivas_dirac_dec_get_response_split_order( azimuth2[k], elevation2[k], direct_response_dir2, shd_rot_max_order, p_Rmat );
                    }
@@ -1879,7 +1866,8 @@ void ivas_dirac_dec_compute_directional_responses(
                else
                {
                    ivas_dirac_dec_get_response( azimuth[k], elevation[k], direct_response_hoa, hDirAC->hOutSetup.ambisonics_order );
                    if ( hodirac )

                    if ( hodirac_flag )
                    {
                        ivas_dirac_dec_get_response( azimuth2[k], elevation2[k], direct_response_dir2, hDirAC->hOutSetup.ambisonics_order );
                    }
@@ -1888,7 +1876,8 @@ void ivas_dirac_dec_compute_directional_responses(
                if ( hMasa == NULL && hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD )
                {
                    mvr2r_inc( direct_response_hoa, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir );
                    if ( hodirac )

                    if ( hodirac_flag )
                    {
                        mvr2r_inc( direct_response_dir2, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k + hDirAC->num_freq_bands * num_channels_dir], hDirAC->num_freq_bands, num_channels_dir );
                    }
+6 −7
Original line number Diff line number Diff line
@@ -159,7 +159,6 @@ static int16_t read_coherence_data_hr_512(
 * Main function for decoding Spatial Metadata
 *-----------------------------------------------------------------------*/


/*! r: number of bits read */
int16_t ivas_qmetadata_dec_decode(
    IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle  */
@@ -167,7 +166,7 @@ int16_t ivas_qmetadata_dec_decode(
    int16_t *index                    /* i/o: bitstream position */
#ifdef HODIRAC
    ,
    int16_t hodirac /* i: flag to indicate sector processing */
    const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */
#endif
)
{
@@ -259,7 +258,7 @@ int16_t ivas_qmetadata_dec_decode(
    bits_diff_sum += ivas_qmetadata_entropy_decode_diffuseness( bitstream, index, &( hQMetaData->q_direction[0] ), &diffuseness_index_max_ec_frame_pre[0] );

#ifdef HODIRAC
    if ( hodirac )
    if ( hodirac_flag )
    {
        if ( hQMetaData->no_directions == 2 )
        {
@@ -312,7 +311,7 @@ int16_t ivas_qmetadata_dec_decode(
                dfRatio_qsteps = 1 << dfRatio_bits[dir2band];
#ifdef HODIRAC
                /* already encoded as total and ratios in HODIRAC*/
                if ( hodirac )
                if ( hodirac_flag )
                {
                    dfRatio = usdequant( hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0], 0.0f, 1.f / ( dfRatio_qsteps - 1 ) );
                    dir1ratio = 1.f - diffRatio;
@@ -331,7 +330,7 @@ int16_t ivas_qmetadata_dec_decode(
                /* Requantize the 1 - dirRatio separately for each direction to obtain inverted dirRatio index. These are used in further decoding. */
                hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0] = masa_sq( 1.0f - dir1ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS );
#ifdef HODIRAC
                if ( hodirac )
                if ( hodirac_flag )
                {
                    float tmp;
                    hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0] = usquant( dir2ratio, &tmp, 0.0f, 1.f / ( DIRAC_DIFFUSE_LEVELS - 1 ), DIRAC_DIFFUSE_LEVELS );
@@ -399,7 +398,7 @@ int16_t ivas_qmetadata_dec_decode(
            masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod
#ifdef HODIRAC
                                                        ,
                                                        hodirac
                                                        hodirac_flag
#endif
            );

@@ -792,7 +791,7 @@ int16_t ivas_qmetadata_dec_decode(

        /* Scale energy ratios that sum to over one */
#ifdef HODIRAC
        if ( !hodirac )
        if ( !hodirac_flag )
#endif
        {
            for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ )
Loading