Commit b6b18432 authored by vaclav's avatar vaclav
Browse files

accept NONBE_FIX_1052_SBA_EXT_FIX and NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER

parent a7381d5d
Loading
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -84,13 +84,9 @@ void ivas_write_format(
void ivas_write_format_sid(
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int16_t element_mode,                                 /* i  : element bitrate                         */
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    BSTR_ENC_HANDLE hBstr,                                      /* i/o: encoder bitstream handle                */
    const int16_t sba_order,                                    /* i  : Ambisonic (SBA) order                   */
    const int16_t sba_planar                                    /* i  : SBA planar flag                         */
#else
    BSTR_ENC_HANDLE hBstr                                       /* i/o: encoder bitstream handle                */
#endif
);

ivas_error create_sce_enc(
+0 −2
Original line number Diff line number Diff line
@@ -172,8 +172,6 @@

#define NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* FhG: issue 1133: skip de-whitening of bg noise shape after frameloss period if the first good frame is an SID */
#define NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID /* FhG: issue 1133: in TCX PLC, don't scale hHQ_core->old_out after applying fade to noise in burst frame error */
#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER                  /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
#define NONBE_FIX_1052_SBA_EXT_FIX                            /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR                       /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */

/* ##################### End NON-BE switches ########################### */
+0 −64
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r
static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );


#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
/*-------------------------------------------------------------------*
 * ivas_set_audio_config_from_sba_order()
 *
@@ -66,12 +65,6 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );
static AUDIO_CONFIG ivas_set_audio_config_from_sba_order(
    const int16_t sba_order /* i  : Ambisonic (SBA) order           */
)
#else
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order );


static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order )
#endif
{
    AUDIO_CONFIG output_config;

@@ -89,12 +82,8 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_ord
            output_config = IVAS_AUDIO_CONFIG_HOA3;
            break;
        default:
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            output_config = IVAS_AUDIO_CONFIG_INVALID;
            break;
#else
            assert( 0 );
#endif
    }

    return output_config;
@@ -179,17 +168,6 @@ ivas_error ivas_dec_setup(
            /* read Ambisonic (SBA) order */
            st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
            st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
#ifndef NONBE_FIX_1052_SBA_EXT_FIX
            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
                st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
#else
                st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
#endif
                st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
            }
#endif

            num_bits_read += SBA_ORDER_BITS;
            if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 )
@@ -429,18 +407,6 @@ ivas_error ivas_dec_setup(
                break;
        }

#ifndef NONBE_FIX_1052_SBA_EXT_FIX
        if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
#else
            st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
#endif
            st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
        }

#endif
        if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT )
        {
            int16_t nchan_transport_old, nchan_transport;
@@ -808,9 +774,7 @@ ivas_error ivas_init_decoder_front(

    st_ivas->nSCE = 0;
    st_ivas->nCPE = 0;
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    st_ivas->nchan_ism = 0;
#endif
    st_ivas->nchan_transport = -1;

    st_ivas->ism_mode = ISM_MODE_NONE;
@@ -976,17 +940,9 @@ ivas_error ivas_init_decoder(
        {
            hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config );
        }
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT )
#else
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#endif
        {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) );
#else
            hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
#endif
            hDecoderConfig->nchan_out += st_ivas->nchan_ism;
        }
        else if ( st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
@@ -1012,17 +968,11 @@ ivas_error ivas_init_decoder(
        ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config );
        st_ivas->intern_config = st_ivas->transport_config;
    }
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) )
#else
    else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == SBA_ISM_FORMAT )
#endif
    {
        st_ivas->intern_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
        ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->intern_config );
    }
#endif
    else
    {
        ivas_output_init( &( st_ivas->hOutSetup ), output_config );
@@ -1036,16 +986,6 @@ ivas_error ivas_init_decoder(
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
    }

#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
    {
        st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
        st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3;
        st_ivas->hOutSetup.output_config = IVAS_AUDIO_CONFIG_HOA3;
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
    }

#endif
    /* Only initialize transport setup if it is used */
    if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID )
    {
@@ -1232,11 +1172,7 @@ ivas_error ivas_init_decoder(
            return error;
        }

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
        if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && !( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA ) )
#else
        if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO )
#endif
        {
            if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK )
            {
+0 −8
Original line number Diff line number Diff line
@@ -318,15 +318,11 @@ void ivas_renderer_select(

        if ( ivas_format == SBA_FORMAT && ( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) )
        {
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
                /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
            }
            else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
#else
            if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
#endif
            {
                *internal_config = output_config;
            }
@@ -334,11 +330,7 @@ void ivas_renderer_select(
            {
                *internal_config = IVAS_AUDIO_CONFIG_FOA;
            }
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
            else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
            if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#endif
            {
                *internal_config = IVAS_AUDIO_CONFIG_HOA3;
            }
+0 −12
Original line number Diff line number Diff line
@@ -1556,11 +1556,7 @@ void ivas_spar_dec_upmixer_sf(
        }
    }

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    if ( hDecoderConfig->ivas_total_brate < IVAS_24k4 && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) )
#else
    if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
#endif
    {
        ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf );
    }
@@ -1570,11 +1566,7 @@ void ivas_spar_dec_upmixer_sf(
        md_idx = hSpar->render_to_md_map[ts + slot_idx_start];
        ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat );

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
        if ( hDecoderConfig->ivas_total_brate < IVAS_24k4 && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) )
#else
        if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
#endif
        {
            for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
            {
@@ -1663,11 +1655,7 @@ void ivas_spar_dec_upmixer_sf(
        }
    }

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && !( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA ) )
#else
    if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO )
#endif
    {
        ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im );
    }
Loading