Commit 1fbb7e93 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/ivas-float-update' into 1870-ref-PortFlpMr1860

parents b72da335 3b23f93e
Loading
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -3220,6 +3220,9 @@ void ivas_qmetadata_enc_sid_encode(
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: metadata bitstream handle               */
    IVAS_QMETADATA *q_metadata,                                 /* i/o: metadata handle                         */
    const int16_t masa_sid_descriptor,                          /* i  : description of MASA SID coding structure*/	
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport, /* i  : number of transport channels                             */
#endif
    const int16_t ivas_format                                   /* i  : ivas format                             */
);

@@ -3523,6 +3526,13 @@ int16_t ivas_sba_get_nchan_metadata(
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
);

#ifdef NONBE_FIX_1052_SBA_EXT
/*! r: number of bits in SPAR SID frame */
int16_t ivas_sba_spar_sid_bitlen(
    const int16_t nchan_transport /* i  : number of transport channels            */
);
#endif

void ivas_sba_get_spar_hoa_ch_ind(
    const int16_t num_md_chs,                                   /* i  : number of MD channels                   */
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
@@ -3624,6 +3634,9 @@ ivas_error ivas_dirac_enc(
    const int16_t input_frame,                                  /* i  : input frame length                      */
    const int16_t dtx_vad,                                      /* i  : DTX vad flag                            */
    const IVAS_FORMAT ivas_format,                              /* i  : ivas format                             */
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport,                              /* i  : number of transport channels                             */
#endif
    const int16_t hodirac_flag                                  /* i  : hodirac flag                            */
);

@@ -3681,6 +3694,9 @@ void ivas_dirac_dec_read_BS(
    int16_t *nb_bits,                                           /* o  : number of bits read                     */
    const int16_t last_bit_pos,                                 /* i  : last read bitstream position            */
    const int16_t hodirac_flag,                                 /* i  : flag to indicate HO-DirAC mode          */
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport,                              /* i  : number of transport channels                             */
#endif
    int16_t *dirac_to_spar_md_bands                             /* o  : DirAC->SPAR MD bands                    */
);

+24 −0
Original line number Diff line number Diff line
@@ -159,6 +159,30 @@ int16_t ivas_sba_get_nchan(
}


#ifdef NONBE_FIX_1052_SBA_EXT
/*-------------------------------------------------------------------*
 * ivas_sba_spar_sid_bitlen()
 *
 * Get number of bits in SPAR SID frame
 *-------------------------------------------------------------------*/

/*! r: number of bits in SPAR SID frame */
int16_t ivas_sba_spar_sid_bitlen(
    const int16_t nchan_transport /* i  : number of transport channels            */
)
{
    int16_t num_bits;

    num_bits = SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND;
    if ( nchan_transport > 1 )
    {
        num_bits -= 2;
    }

    return num_bits;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_sba_get_nchan_metadata()
 *
+4 −1
Original line number Diff line number Diff line
@@ -170,7 +170,6 @@
#define NONBE_1319_M2R_PRECISION_ALIGN                  /* Nokia: bring updates from PC code related to OMASA masa2total ratios */
#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */
#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT  /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */
/*#define NONBE_FIX_MC_LFE_LPF*/                                  /* Dlb: Adding the LFE LPF filter back for MC content. */

/* #################### End FIXES switches ############################ */

@@ -181,6 +180,7 @@
#define USE_NEW_HRTF_BINARY_FILE_FORMAT                 /* Orange: to activate when decided to change the hrtf binary file format */
#define FIX_WARNING_RENDER_CONFIG                       /* Orange: fix warning on windows build */
#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF              /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to actiate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on  )*/
#define LC3PLUS_LEA_COMPAT_BITRATES_48_6                /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel)  */
#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS            /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals  */
#define FIX_1053_REVERB_RECONFIGURATION                 /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define NONBE_FIX_SBA_SIGNALING_BITS_B                  /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
@@ -193,7 +193,10 @@
#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT   /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ 

#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR          /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define NONBE_FIX_MC_LFE_LPF                                  /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1052_SBA_EXT                          /* Dlb: SBA external output support */
#define FIX_1082_INSTRUM_FAILED_LC3PLUS                 /* VoiceAge: issue 1082: fix ambiguous syntax in LC3Plus code leading to fails of instrumented builds */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR            /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS              /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */

/* #################### End BASOP porting switches ############################ */
+19 −1
Original line number Diff line number Diff line
@@ -977,6 +977,9 @@ void ivas_dirac_dec_read_BS(
    int16_t *nb_bits,                                     /* o  : number of bits read             */
    const int16_t last_bit_pos,                           /* i  : last read bitstream position    */
    const int16_t hodirac_flag,                           /* i  : flag to indicate HO-DirAC mode  */
#ifdef NONBE_FIX_1052_SBA_EXT
    const int16_t nchan_transport, /* i  : number of transport channels                             */
#endif
    int16_t *dirac_to_spar_md_bands /* o  : DirAC->SPAR MD bands            */
)
{
@@ -1010,7 +1013,11 @@ void ivas_dirac_dec_read_BS(
                }
            }

#ifdef NONBE_FIX_1052_SBA_EXT
            *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );
#else
            *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT );
#endif
            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];
@@ -1058,7 +1065,12 @@ void ivas_dirac_dec_read_BS(
        next_bit_pos_orig = st->next_bit_pos;

        /* subtract mode signaling bits, since bitstream was moved after mode reading */

#ifdef NONBE_FIX_1052_SBA_EXT
        st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS - SBA_PLANAR_BITS - SBA_ORDER_BITS );
#else
        st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS );
#endif
        /* 1 bit flag for signaling metadata to read */
        b = st->bit_stream[( st->next_bit_pos )--];
        ( *nb_bits )++;
@@ -1078,7 +1090,13 @@ void ivas_dirac_dec_read_BS(
            }
        }


#ifdef NONBE_FIX_1052_SBA_EXT
        *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );
#else
        *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT );
#endif

        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];
+74 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ 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_1052_SBA_EXT
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order );
#endif

static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );


@@ -236,6 +240,30 @@ static ivas_error ivas_dec_init_split_rend(
    return error;
}


#ifdef NONBE_FIX_1052_SBA_EXT
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order )
{
    AUDIO_CONFIG output_config;
    output_config = IVAS_AUDIO_CONFIG_HOA3;
    switch ( sba_order )
    {
        case SBA_FOA_ORDER:
            output_config = IVAS_AUDIO_CONFIG_FOA;
            break;
        case SBA_HOA2_ORDER:
            output_config = IVAS_AUDIO_CONFIG_HOA2;
            break;
        case SBA_HOA3_ORDER:
            output_config = IVAS_AUDIO_CONFIG_HOA3;
            break;
        default:
            assert( 0 );
    }
    return output_config;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_dec_setup()
 *
@@ -315,6 +343,14 @@ ivas_error ivas_dec_setup(
            st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
            st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];

#ifdef NONBE_FIX_1052_SBA_EXT
            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
                st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
                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 )
            {
@@ -349,12 +385,30 @@ ivas_error ivas_dec_setup(

            if ( st_ivas->nchan_ism > 0 )
            {
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
                /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
                /* info about the number of objects:
                          '00' - MASA format at the encoder
                          '01' - MASA_ISM_FORMAT at the encoder, with 4 objects
                          '10' - MASA_ISM_FORMAT at the encoder, with 3 objects
                          '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects
                          reading if 1 or 2 objects is performed later
                */
                st_ivas->nchan_ism = 5 - st_ivas->nchan_ism;
                if ( st_ivas->nchan_transport == 1 && st_ivas->nchan_ism == 2 )
                {
                    st_ivas->nchan_ism = 1;
                }
                /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
#else
                /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
                if ( st_ivas->nchan_transport == 2 && st_ivas->nchan_ism == 3 )
                {
                    st_ivas->nchan_ism = 4;
                }

                /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */
#endif
                st_ivas->nchan_transport = 2;
                element_mode_flag = 1;
            }
@@ -570,6 +624,15 @@ ivas_error ivas_dec_setup(
                break;
        }


#ifdef NONBE_FIX_1052_SBA_EXT
        if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
            st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
            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;
@@ -837,6 +900,17 @@ static ivas_error ivas_read_format(

        if ( st_ivas->ivas_format == SBA_FORMAT )
        {

#ifdef NONBE_FIX_1052_SBA_EXT
            /* read Ambisonic (SBA) planar flag */
            st_ivas->sba_planar = st_ivas->bit_stream[*num_bits_read];
            *num_bits_read += SBA_PLANAR_BITS;

            /* 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];
            *num_bits_read += SBA_ORDER_BITS;
#endif
            if ( st_ivas->sba_analysis_order == 0 )
            {
                st_ivas->sba_analysis_order = SBA_FOA_ORDER;
Loading