Commit 9ad6ef61 authored by vaclav's avatar vaclav
Browse files

Merge branch 'sba-ext-fix' into 'main'

[non-be] SBA EXT fix

See merge request !1548
parents 9289f021 b00423d6
Loading
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -84,7 +84,13 @@ 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(
@@ -3492,7 +3498,7 @@ int16_t ivas_sba_get_nchan_metadata(
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
);

/*! r: number of bits in SPAR SID frame */
/*! r: number of bits in SBA SPAR SID frame */
int16_t ivas_sba_spar_sid_bitlen(
    const int16_t nchan_transport                               /* i  : number of transport channels            */
);
+3 −2
Original line number Diff line number Diff line
@@ -158,13 +158,14 @@ int16_t ivas_sba_get_nchan(
    return ( nb_channels );
}


/*-------------------------------------------------------------------*
 * ivas_sba_spar_sid_bitlen()
 *
 * Get number of bits in SPAR SID frame
 * Get number of bits in SBA SPAR SID frame
 *-------------------------------------------------------------------*/

/*! r: number of bits in SPAR SID frame */
/*! r: number of bits in SBA SPAR SID frame */
int16_t ivas_sba_spar_sid_bitlen(
    const int16_t nchan_transport /* i  : number of transport channels            */
)
+2 −1
Original line number Diff line number Diff line
@@ -176,8 +176,9 @@

#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING             /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */
#define NONBE_1131_ACELP_OOB                                  /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */

#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 */


/* ##################### End NON-BE switches ########################### */

+3 −1
Original line number Diff line number Diff line
@@ -1056,6 +1056,7 @@ void ivas_dirac_dec_read_BS(

        /* subtract mode signaling bits, since bitstream was moved after mode reading */
        st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS - SBA_PLANAR_BITS - SBA_ORDER_BITS );

        /* 1 bit flag for signaling metadata to read */
        b = st->bit_stream[( st->next_bit_pos )--];
        ( *nb_bits )++;
@@ -1076,6 +1077,7 @@ void ivas_dirac_dec_read_BS(
        }

        *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );

        for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
        {
            hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0];
+19 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ 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
@@ -188,6 +189,7 @@ ivas_error ivas_dec_setup(
#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 )
@@ -427,6 +429,7 @@ 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
@@ -437,6 +440,7 @@ ivas_error ivas_dec_setup(
            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;
@@ -804,6 +808,9 @@ 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;
@@ -969,7 +976,11 @@ 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 ) );
@@ -1002,7 +1013,11 @@ ivas_error ivas_init_decoder(
        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 );
@@ -1217,7 +1232,11 @@ 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 )
            {
Loading