Commit cdaba654 authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

commit 4

parent 52a7b10b
Loading
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ ivas_error ivas_param_mc_dec_open_fx(
    {
        test();
        test();
        IF( ( NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_32( nchan_out_transport, audioCfg2channels( output_config ) ) ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_32( nchan_out_transport, st_ivas->hOutSetup.nchan_out_woLFE ) ) )
        IF( ( NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_16( nchan_out_transport, audioCfg2channels( output_config ) ) ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_16( nchan_out_transport, st_ivas->hOutSetup.nchan_out_woLFE ) ) )
        {
            hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_COV;
            move32();
@@ -287,6 +287,7 @@ ivas_error ivas_param_mc_dec_open_fx(
    }

    st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup );
    move16();
    config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate );
    nchan_transport = st_ivas->nchan_transport;
    move16();
@@ -332,6 +333,7 @@ ivas_error ivas_param_mc_dec_open_fx(

    // hParamMC->num_freq_bands = (int16_t)(output_Fs * INV_CLDFB_BANDWIDTH + 0.5f);
    hParamMC->num_freq_bands = extract_l( Mpy_32_32_r( output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) );
    move16();
    hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands;
    move16();
#ifndef FIX_901_PARAMMC_DEAD_CODE
@@ -606,7 +608,8 @@ ivas_error ivas_param_mc_dec_open_fx(
        }
        set32_fx( hParamMC->Cldfb_ImagBuffer_tc_fx, 0, cldfb_buf_size );

        hParamMC->sz = n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands;
        hParamMC->sz = imult1616( imult1616( n_cldfb_slots, nchan_transport ), hParamMC->num_freq_bands );
        move16();

        IF( st_ivas->hTcBuffer == NULL )
        {
@@ -1067,6 +1070,7 @@ static void ivas_param_mc_get_param_band_mapping(
        for ( source_band_idx = 0; source_band_idx < source_band_in_target_band_cnt; source_band_idx++ )
        {
            parameter_band_mapping->source_band_factor_fx[target_band_idx][source_band_idx] = shl_sat( mult( parameter_band_mapping->source_band_factor_fx[target_band_idx][source_band_idx], norm_fac_fx ) /*Q10*/, 5 ); /*Q15*/
            move16();
        }
        parameter_band_mapping->n_source_bands[target_band_idx] = source_band_in_target_band_cnt;
        move16();
@@ -1190,6 +1194,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx(
    }

    st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup );
    move16();
    config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate );
    nchan_transport = st_ivas->nchan_transport;
    move16();
@@ -1220,6 +1225,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx(
     * set input parameters
     *-----------------------------------------------------------------*/
    hParamMC->num_freq_bands = shr( add( (Word16) Mpy_32_32( output_Fs, INV_CLDFB_BANDWIDTH_Q31 << 1 ), 1 ), 1 );
    move16();
    hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands;
    move16();

@@ -3035,6 +3041,7 @@ void ivas_param_mc_dec_digest_tc_fx(
    IF( hParamMC->hMetadataPMC->bAttackPresent )
    {
        hParamMC->hMetadataPMC->attackIndex = s_max( 0, add( hParamMC->hMetadataPMC->attackIndex, shr( sub( nCldfbSlots, DEFAULT_JBM_CLDFB_TIMESLOTS ), 1 ) ) );
        move16();
    }
    /* adapt subframes */
    hParamMC->num_slots = nCldfbSlots;
@@ -3114,7 +3121,9 @@ void ivas_param_mc_dec_digest_tc_fx(
        {

            real_part_fx = cx_fx[param_band_idx][i];
            move16();
            imag_part_fx = cx_imag_fx[param_band_idx][i];
            move16();
            cx_buff_e[param_band_idx][i] = cx_e;
            move16();

@@ -3564,6 +3573,7 @@ void ivas_param_mc_dec_render_fx(
    temp = shr( temp, sub( 15, temp_e ) );
    slots_to_render = s_min( sub( hParamMC->num_slots, hParamMC->slots_rendered ), temp );
    *nSamplesRendered = imult1616( slots_to_render, NS2SA( output_Fs, CLDFB_SLOT_NS ) );
    move16();
    Word16 j, k;
    first_sf = hParamMC->subframes_rendered;
    move16();
@@ -4653,6 +4663,7 @@ static Word16 ivas_param_mc_range_decoder_LC_fx(
        IF( GT_16( cur_bit_pos, nbbits ) )
        {
            *BER_detect = s_or( *BER_detect, 1 );
            move16();
        }

        x[k] = r;
@@ -4666,6 +4677,7 @@ static Word16 ivas_param_mc_range_decoder_LC_fx(
    IF( rc_st_dec.bit_error_detected != 0 )
    {
        *BER_detect = s_or( *BER_detect, 1 );
        move16();
    }

    return cur_bit_pos;
@@ -5285,6 +5297,7 @@ static void ivas_param_mc_get_mixing_matrices_fx(
    Word16 tmp_e, tmp;

    Word16 proto_matrix_e = hParamMC->h_output_synthesis_params.proto_matrix_e;
    move16();
    Word32 proto_matrix_noLFE_fx[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS];

    Word32 mat_mult_buffer1_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS];
@@ -5302,6 +5315,7 @@ static void ivas_param_mc_get_mixing_matrices_fx(
    set_zero_fx( mat_mult_buffer1_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS );
    set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS );
    Word16 proto_matrix_noLFE_e = 0;
    move16();

    Word16 guard_bit_cx = find_guarded_bits_fx( nY_intern + 1 );
    Word16 guard_bit_cy = find_guarded_bits_fx( nY_cov * nY_cov );
@@ -6313,7 +6327,9 @@ static void ivas_param_mc_dequantize_cov_fx(
        FOR( l = 0; l < nY_int; l++ )
        {
            ( *Cyp_fx ) = Mpy_32_32( *Cyp_fx, ap_fx );
            move32();
            ( *Cyp_e ) = add( *Cyp_e, ap_e );
            move16();

            Cyp_fx += nY_int;
            Cyp_e += nY_int;
@@ -6402,7 +6418,9 @@ static void ivas_param_mc_dequantize_cov_fx(
            FOR( l = 0; l < nY_cov; l++ )
            {
                ( *Cyp_fx ) = Mpy_32_32( *Cyp_fx, ap_fx );
                move32();
                *Cyp_e = add( *Cyp_e, ap_e );
                move16();

                Cyp_fx += nY_cov;
                Cyp_e += nY_cov;
@@ -6483,6 +6501,7 @@ static void param_mc_set_num_synth_bands(
    }
    move16();
    hParamMC->num_param_bands_synth = s_min( hParamMC->hMetadataPMC->nbands_coded, max_param_band_synth );
    move16();

    return;
}
@@ -6906,6 +6925,7 @@ static void ivas_param_mc_bs_decode_parameter_values_fx(
    range_coding = bit_buffer[*bit_pos];
    move16();
    *bit_pos = add( *bit_pos, 1 );
    move16();

    /* Decoding the sequence */
    n_lfe_idx = sub( map_size, map_size_wo_lfe );
@@ -6919,6 +6939,7 @@ static void ivas_param_mc_bs_decode_parameter_values_fx(
        delta_coding = bit_buffer[*bit_pos];
        move16();
        *bit_pos = add( *bit_pos, 1 );
        move16();

        IF( delta_coding )
        {
@@ -6929,6 +6950,7 @@ static void ivas_param_mc_bs_decode_parameter_values_fx(
            /* read range coded delta ICC indices */
            *bit_pos = add( *bit_pos, ivas_param_mc_range_decoder_LC_fx( &bit_buffer[*bit_pos], delta_idx, BER_detect, sz_seq, sz_alphabet,
                                                                         hParamCodingInfo->cum_freq_delta, hParamCodingInfo->sym_freq_delta, PARAM_MC_RANGE_CODER_TOT_SHIFT, sub( max_bits, *bit_pos ) ) );
            move16();

            /* delta index to absolute index  */
            FOR( j = 0; j < sz_seq; j++ )
@@ -6945,6 +6967,7 @@ static void ivas_param_mc_bs_decode_parameter_values_fx(
            move16();
            *bit_pos = add( *bit_pos, ivas_param_mc_range_decoder_LC_fx( &bit_buffer[*bit_pos], idx, BER_detect, sz_seq, sz_alphabet,
                                                                         hParamCodingInfo->cum_freq, hParamCodingInfo->sym_freq, PARAM_MC_RANGE_CODER_TOT_SHIFT, sub( max_bits, *bit_pos ) ) );
            move16();
        }

        /* dequantize */
@@ -6959,6 +6982,7 @@ static void ivas_param_mc_bs_decode_parameter_values_fx(
        set16_fx( dequant_seq_fx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE );
        /* read uniformly coded ICCs */
        *bit_pos = add( *bit_pos, ivas_param_mc_uniform_decoder_fx( dequant_seq_fx, sz_seq, hParamCodingInfo->quantizer_fx, hParamCodingInfo->uni_bits, &bit_buffer[*bit_pos] ) );
        move16();
    }

    /* reorder from sequential to parameter-band-wise */
+9 −1
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ void ivas_mc_paramupmix_dec_read_BS(
        st0->next_bit_pos = 0;
        move16();
        st0->bits_frame = s_min( MAX_BITS_METADATA, add( last_bit_pos, 1 ) );
        move16();
        st0->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* to avoid BER detect */
        move32();

@@ -147,6 +148,7 @@ void ivas_mc_paramupmix_dec_read_BS(
            get_ec_data( st0, BETA, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas_fx[i] );
        }
        *nb_bits = add( *nb_bits, st0->next_bit_pos );
        move16();
        st0->bit_stream = bit_stream_orig;
        st0->next_bit_pos = next_bit_pos_orig;
        move16();
@@ -231,8 +233,9 @@ void ivas_mc_paramupmix_dec_render(
    move16();

    /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
    slots_to_render = s_min( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), nSamplesAsked / slot_size );
    slots_to_render = s_min( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), idiv1616( nSamplesAsked, slot_size ) );
    *nSamplesRendered = imult1616( slots_to_render, (Word16) slot_size );
    move16();
    first_sf = st_ivas->hTcBuffer->subframes_rendered;
    move16();
    last_sf = first_sf;
@@ -278,6 +281,7 @@ void ivas_mc_paramupmix_dec_render(
    }

    *nSamplesAvailable = imult1616( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), (Word16) slot_size );
    move16();

    pop_wmops();
    return;
@@ -396,6 +400,7 @@ ivas_error ivas_mc_paramupmix_dec_open(
        IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) )
        {
            buffer_mode = TC_BUFFER_MODE_BUFFER;
            move32();
            nchan_tc = st_ivas->hDecoderConfig->nchan_out;
            move16();
            nchan_to_allocate = nchan_tc;
@@ -501,6 +506,7 @@ static void paramupmix_td_decorr_process_jbm_fx(
                move16();
            }
            q_format[k] = sub( q_format[k], Q1 );
            move16();
        }

        /* All pass delay section */
@@ -515,6 +521,7 @@ static void paramupmix_td_decorr_process_jbm_fx(
                move32();
            }
            q_format[k] = sub( q_format[k], Q1 );
            move16();
        }
    }

@@ -952,6 +959,7 @@ static Word16 huff_read(
        next_bit = st->bit_stream[st->next_bit_pos];
        move16();
        st->next_bit_pos = add( st->next_bit_pos, 1 );
        move16();
        node = ht[node][next_bit];
        move16();
    }
+21 −2
Original line number Diff line number Diff line
@@ -431,8 +431,10 @@ ivas_error ivas_mct_dec_fx(
        }

        st_ivas->BER_detect = s_or( st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect );
        move16();
        test();
        st_ivas->BER_detect = s_or( st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect );
        move16();
        test();
    }

@@ -650,6 +652,7 @@ ivas_error ivas_mct_dec_fx(
            Scale_sig32( output_fx_, L_FRAME48k, Q16 - Q11 );
            Copy_Scale_sig32_16( sts[n]->prev_synth_buffer32_fx, sts[n]->prev_synth_buffer_fx, NS2SA( 48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), -11 );
            sts[n]->q_prev_synth_buffer_fx = 0;
            move16();

            save_synthesis_hq_fec_fx( sts[n], output_fx_, output_frame, hCPE );

@@ -742,15 +745,18 @@ ivas_error create_mct_dec_fx(
        IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
        {
            hMCT->nchan_out_woLFE = add( hMCT->nchan_out_woLFE, st_ivas->nchan_ism );
            move16();
        }
    }
    ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) )
    {
        hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe );
        move16();
    }
    ELSE IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
    {
        hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe );
        move16();
    }
    ELSE
    {
@@ -993,15 +999,18 @@ ivas_error mct_dec_reconfigure_fx(
            IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
            {
                hMCT->nchan_out_woLFE = add( hMCT->nchan_out_woLFE, st_ivas->nchan_ism );
                move16();
            }
        }
        ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
        {
            hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe );
            move16();
        }
        ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
        {
            hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe );
            move16();
        }
        ELSE
        {
@@ -1052,7 +1061,9 @@ ivas_error mct_dec_reconfigure_fx(
            {
                tmp = BASOP_Util_Divide3232_Scale( st_ivas->hCPE[cpe_id]->element_brate, FRAMES_PER_SEC, &tmp_exp );
                st->bits_frame_nominal = shr( tmp, sub( 15, tmp_exp ) );
                move16();
                st->igf = getIgfPresent_fx( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); // no floating point so directly pluggable
                move16();

                IF( st->igf )
                {
@@ -1064,7 +1075,7 @@ ivas_error mct_dec_reconfigure_fx(

    /*Initialize MCT block data */
    tmp = BASOP_Util_Divide1616_Scale( hMCT->nchan_out_woLFE, CPE_CHANNELS, &tmp_exp );
    max_blocks = shr( tmp, 15 - tmp_exp );
    max_blocks = shr( tmp, sub( 15, tmp_exp ) );

    FOR( n = 0; n < max_blocks; n++ )
    {
@@ -1406,6 +1417,7 @@ ivas_error ivas_mc_dec_config_fx(

        /* select MC format mode */
        st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate );
        move32();

        /* MC format switching */
        IF( st_ivas->ini_frame != 0 )
@@ -1418,9 +1430,10 @@ ivas_error ivas_mc_dec_config_fx(
                    FOR( Word16 i = 0; i < 4; i++ )
                    {
                        st_ivas->hRenderConfig->directivity_fx[add( imult1616( i, 3 ), 2 )] = shl_sat( st_ivas->hRenderConfig->directivity_fx[add( imult1616( i, 3 ), 2 )], 9 );
                        move16();
                    }
                }
                IF( ( error = ivas_mc_dec_reconfig_fx( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK )
                IF( NE_32( ( error = ivas_mc_dec_reconfig_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -1429,6 +1442,7 @@ ivas_error ivas_mc_dec_config_fx(
                    FOR( Word16 i = 0; i < 4; i++ )
                    {
                        st_ivas->hRenderConfig->directivity_fx[add( imult1616( i, 3 ), 2 )] = shr( st_ivas->hRenderConfig->directivity_fx[add( imult1616( i, 3 ), 2 )], 9 );
                        move16();
                    }
                }
            }
@@ -1555,6 +1569,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
        move16();
    }
    st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );
    move16();

    /* save old IntSetup, might be needed for JBM flushing...*/
    intern_config_old = st_ivas->intern_config;
@@ -1620,9 +1635,11 @@ static ivas_error ivas_mc_dec_reconfig_fx(
    IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) )
    {
        st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ) );
        move16();
        st_ivas->nSCE = 0;
        move16();
        st_ivas->nCPE = shr( st_ivas->nchan_transport, 1 );
        move16();

        IF( NE_16( last_mc_mode, MC_MODE_MCT ) )
        {
@@ -1876,6 +1893,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
        }

        st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode );
        move16();
    }
    IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) )
    {
@@ -2014,6 +2032,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
        AUDIO_CONFIG output_config;

        output_config = st_ivas->hDecoderConfig->output_config;
        move32();

        /* binaural renderers*/
        test();