Commit b4593201 authored by emerit's avatar emerit
Browse files

code simplification

parent f32c3593
Loading
Loading
Loading
Loading
+26 −42
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ ivas_error ivas_ism_metadata_dec(

    push_wmops( "ism_meta_dec" );


    /* initialization */
    st0 = hSCE[0]->hCoreCoder[0];
    ism_metadata_flag_global = 0;
@@ -250,10 +251,11 @@ ivas_error ivas_ism_metadata_dec(
            }
        }

        /* Read ISm present flags (one per object) */
        /* Read ISM present flags (one per object) */
        for ( ch = 0; ch < *nchan_transport; ch++ )
        {
            ism_imp[ch] = get_next_indice( st0, ISM_METADATA_FLAG_BITS );

            if ( ism_imp[ch] > ISM_NO_META )
            {
                hIsmMeta[ch]->ism_metadata_flag = 1;
@@ -314,7 +316,6 @@ ivas_error ivas_ism_metadata_dec(
                {
                    hIsmMetaData->ism_metadata_flag += get_next_indice( st0, ISM_METADATA_IS_NDP_BITS );
                }
#endif

                if ( hIsmMetaData->ism_metadata_flag == 2 )
                {
@@ -342,7 +343,6 @@ ivas_error ivas_ism_metadata_dec(
                        nb_bits_metadata[ch] = st0->next_bit_pos - nb_bits_start;
                    }
                }
#ifdef ISM_NON_DIEGETIC_PAN
                if ( hIsmMeta[ch]->ism_metadata_flag == 1 )
                {
#else
@@ -863,6 +863,7 @@ static int16_t decode_radius(
    return idx_radius;
}


/*-------------------------------------------------------------------*
 * ivas_ism_metadata_sid_dec()
 *
@@ -930,6 +931,7 @@ void ivas_ism_metadata_sid_dec(
        /* update the position in the bitstream */
        st0->next_bit_pos += nchan_ism;

        /* read SID metadata flag( one per object ) */
        for ( ch = 0; ch < nchan_ism; ch++ )
        {
            md_diff_flag[ch] = get_next_indice( st0, 1 );
@@ -1025,6 +1027,7 @@ void ivas_ism_metadata_sid_dec(
        /*----------------------------------------------------------------*
         * Metadata decoding and dequantization, loop over all objects
         *----------------------------------------------------------------*/

        for ( ch = 0; ch < nchan_ism; ch++ )
        {
            hIsmMetaData = hIsmMeta[ch];
@@ -1032,40 +1035,24 @@ void ivas_ism_metadata_sid_dec(
            if ( md_diff_flag[ch] == 1 )
            {

#ifdef ISM_NON_DIEGETIC_PAN_SID
                if ( hIsmMetaData->ism_metadata_flag == 2 )
                {
                /* Azimuth decoding */
                idx_azimuth = get_next_indice( st0, nBits_azimuth );
                hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth );
                    hIsmMetaData->elevation = 0.0f;
                    /* update last indexes to correspond to active frames coding */
                    if ( nBits_azimuth > ISM_AZIMUTH_NBITS )
                    {
                        hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS );
                        hIsmMetaData->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 );
                    }
                    else
#ifdef ISM_NON_DIEGETIC_PAN_SID
                if ( hIsmMetaData->ism_metadata_flag == 2 )
                {
                        hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth );
                        hIsmMetaData->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 );
                    }

                    /* save for smoothing metadata evolution */
                    hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth;
                    hIsmMetaData->elevation = hIsmMetaData->elevation;
                    idx_elevation = 1 << ( ISM_ELEVATION_NBITS - 1 );
                    hIsmMetaData->elevation = 0.0f;
                }
                else
                {
#endif
                    /* Azimuth decoding */
                    idx_azimuth = get_next_indice( st0, nBits_azimuth );
                    hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth );

                    /* Elevation decoding */
                    idx_elevation = get_next_indice( st0, nBits_elevation );
                    hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation );

#ifdef ISM_NON_DIEGETIC_PAN_SID
                }
#endif
                /* update last indexes to correspond to active frames coding */
                if ( nBits_azimuth > ISM_AZIMUTH_NBITS )
                {
@@ -1081,9 +1068,6 @@ void ivas_ism_metadata_sid_dec(
                /* save for smoothing metadata evolution */
                hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth;
                hIsmMetaData->last_true_elevation = hIsmMetaData->elevation;
#ifdef ISM_NON_DIEGETIC_PAN
                }
#endif
            }
        }