diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 83cf758b11806c8bebb43c918fe96bb6a951b614..7dff23282d6d9dbb5a94ae7fd89324d696ed88e3 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2338,7 +2338,7 @@ void ivas_dirac_dec_read_BS_fx( const Word16 last_bit_pos, /* i : last read bitstream position */ const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ #ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_transport, /* i : number of transport channels */ #endif Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -2501,7 +2501,7 @@ Word16 ivas_sba_get_nchan_metadata_fx( ); #ifdef NONBE_FIX_1052_SBA_EXT -/*! r: number of bits in SPAR SID frame */ +/*! r: number of bits in SBQ SID frame */ Word16 ivas_sba_spar_sid_bitlen_fx( const Word16 nchan_transport /* i : number of transport channels */ ); @@ -3500,7 +3500,9 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512_fx( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ const Word16 bits_sph_idx, - const Word16 bits_sp_coh ); + const Word16 bits_sp_coh +); + void ivas_merge_masa_metadata_fx( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */ OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */ @@ -3512,7 +3514,7 @@ void ivas_qmetadata_enc_sid_encode_fx( IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure*/ #ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_transport, /* i : number of transport channels */ #endif const Word16 ivas_format /* i : ivas format */ ); @@ -3522,12 +3524,14 @@ void ivas_param_mc_enc_fx( Word32 *data_f_fx[], /* i/o: input/transport MC data Q11 */ const Word16 input_frame /* i : input frame length */ ); + void ivas_merge_masa_transports_fx( Word32 data_in_f1_fx[][L_FRAME48k], // Qx Word32 *data_in_f2_fx[], // Qx Word32 *data_out_f_fx[], // Qx const Word16 input_frame, - const Word16 num_transport_channels ); + const Word16 num_transport_channels +); void ivas_param_mc_enc_close_fx( PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ @@ -3624,24 +3628,31 @@ ivas_error ivas_masa_encode_fx( ); void ivas_write_format_sid_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 element_mode, /* i : element bitrate */ - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 element_mode, /* i : element bitrate */ +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 sba_planar /* i : SBA planar flag */ +#else +BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ +#endif ); -void ivas_write_format_fx( /* i/o: IVAS encoder structure */ - Encoder_Struct *st_ivas ); +void ivas_write_format_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); ivas_error create_sce_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 sce_id, /* i : SCE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 sce_id, /* i : SCE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); ivas_error create_cpe_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - const Word32 element_brate /* i : element bitrate */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + const Word32 element_brate /* i : element bitrate */ ); void ivas_quantise_real_values_fx( @@ -5848,10 +5859,11 @@ ivas_error ivas_dirac_enc_fx( const Word16 dtx_vad, /* i : DTX vad flag */ const IVAS_FORMAT ivas_format, /* i : ivas format */ #ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_transport, /* i : number of transport channels */ #endif const Word16 hodirac_flag, /* i : hodirac flag */ - const Word16 shift ); + const Word16 shift +); ivas_error ivas_spar_md_enc_init_fx( ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c index 999caf3cc11e27012bd7624b6afa75236c2cc897..bce2be80cd35cafd16349f7f39638dd6a12f6ba9 100644 --- a/lib_com/ivas_sba_config_fx.c +++ b/lib_com/ivas_sba_config_fx.c @@ -171,10 +171,10 @@ Word16 ivas_sba_get_nchan_fx( /*-------------------------------------------------------------------* * ivas_sba_spar_sid_bitlen_fx() * - * Get number of bits in SPAR SID frame + * Get number of bits in SBA SID frame *-------------------------------------------------------------------*/ -/*! r: number of bits in SPAR SID frame */ +/*! r: number of bits in SBA SID frame */ Word16 ivas_sba_spar_sid_bitlen_fx( const Word16 nchan_transport /* i : number of transport channels */ ) @@ -191,6 +191,7 @@ Word16 ivas_sba_spar_sid_bitlen_fx( } #endif + /*-------------------------------------------------------------------* * ivas_sba_get_nchan_metadata() * diff --git a/lib_com/options.h b/lib_com/options.h index 25d559cae04133a1fda1c739c32edb84f9c503d0..62bccdca6536e2e4961f77e12566b9d760a3e613 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -122,7 +122,6 @@ #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 */ #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 */ - #define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */ #define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ #define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ @@ -130,6 +129,7 @@ #define FIX_1138_SBA_EXT_ERROR_PRINTOUT /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */ #define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ #define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ +#define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index be043d5b82224296288bdf4e1a46ea0ac69f0f41..2516d4ebdbc29f17bb5da4069ea2e6417be0894d 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1247,7 +1247,7 @@ void ivas_dirac_dec_read_BS_fx( const Word16 last_bit_pos, /* i : last read bitstream position */ const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ #ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_transport, /* i : number of transport channels */ #endif Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) @@ -1292,6 +1292,7 @@ void ivas_dirac_dec_read_BS_fx( set32_fx( hQMetaData->q_direction[0].band_data[b].elevation_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } } + #ifdef NONBE_FIX_1052_SBA_EXT *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT ) ); move16(); @@ -1393,6 +1394,7 @@ void ivas_dirac_dec_read_BS_fx( *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ) ); move16(); #endif + FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth_fx[i] = hQMetaData->q_direction[0].band_data[1].azimuth_fx[0]; @@ -2269,16 +2271,6 @@ void ivas_dirac_dec_render_sf_fx( move16(); move16(); - - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - FOR( Word16 j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - set32_fx( Cldfb_RealBuffer_fx[i][j], 0, CLDFB_NO_CHANNELS_MAX ); - set32_fx( Cldfb_ImagBuffer_fx[i][j], 0, CLDFB_NO_CHANNELS_MAX ); - } - } - /* local copies of azi, ele, diffuseness */ Word16 azimuth[CLDFB_NO_CHANNELS_MAX]; Word16 elevation[CLDFB_NO_CHANNELS_MAX]; @@ -2325,7 +2317,6 @@ void ivas_dirac_dec_render_sf_fx( push_wmops( "ivas_dirac_dec_render" ); /* Initialize aux buffers */ - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { FOR( Word16 j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index a2e9ad0a1224c9bb15bad76ef08f6e2c5f172981..f79ca8cca7e1f579056ced45bdc42b4ff6aba92a 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -408,6 +408,7 @@ ivas_error ivas_dec_setup( move16(); st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) ); move16(); +#ifndef NONBE_FIX_1052_SBA_EXT_FIX #ifdef NONBE_FIX_1052_SBA_EXT IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { @@ -419,8 +420,9 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config ); } #endif - +#endif num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); + test(); test(); IF( st_ivas->ini_frame > 0 && NE_32( ivas_total_brate, st_ivas->last_active_ivas_total_brate ) && GT_32( ivas_total_brate, IVAS_SID_5k2 ) ) @@ -733,6 +735,7 @@ ivas_error ivas_dec_setup( BREAK; } +#ifndef NONBE_FIX_1052_SBA_EXT_FIX #ifdef NONBE_FIX_1052_SBA_EXT IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { @@ -744,7 +747,7 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config ); } #endif - +#endif test(); IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) { @@ -1098,6 +1101,7 @@ static ivas_error ivas_read_format( *num_bits_read = add( *num_bits_read, SBA_ORDER_BITS ); move16(); #endif + if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = SBA_FOA_ORDER; @@ -1195,11 +1199,13 @@ void copy_decoder_config( return; } + /*-------------------------------------------------------------------* * ivas_init_decoder_front() * * Set decoder parameters to initial values *-------------------------------------------------------------------*/ + ivas_error ivas_init_decoder_front( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -1216,6 +1222,10 @@ ivas_error ivas_init_decoder_front( move16(); st_ivas->nCPE = 0; move16(); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + st_ivas->nchan_ism = 0; + move16(); +#endif st_ivas->nCPE_old = 0; move16(); st_ivas->nchan_transport = -1; @@ -1379,10 +1389,13 @@ ivas_error ivas_init_decoder_fx( move32(); st_ivas->last_active_ivas_total_brate = ivas_total_brate; move32(); + /*-----------------------------------------------------------------* * Set number of output channels for EXTERNAL output config. *-----------------------------------------------------------------*/ + test(); + test(); IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT @@ -1397,7 +1410,11 @@ ivas_error ivas_init_decoder_fx( { hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config ); } +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) +#else ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) +#endif #else IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #endif @@ -1437,6 +1454,8 @@ ivas_error ivas_init_decoder_fx( st_ivas->intern_config = output_config; move32(); + test(); + test(); #ifdef FIX_1052_EXT_OUTPUT IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { @@ -1445,7 +1464,11 @@ ivas_error ivas_init_decoder_fx( move32(); } #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( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( 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 ); @@ -1741,7 +1764,12 @@ ivas_error ivas_init_decoder_fx( test(); test(); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + test(); + IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) ) +#else IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) +#endif { IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index bb604732fb3af3c78a4ed0b79f483acbe274c4fb..3065722f704dec785e9fb0af8a74fcdc841f4f56 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -397,7 +397,15 @@ void ivas_renderer_select( { test(); test(); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + { + /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */ + } + ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) ) +#else IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) ) +#endif { *internal_config = output_config; move16(); diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index f96608d24f51caad7a89d7841abd5cd3c2115f29..8832730bafaf5151a1890403d42bb3d72f5288c4 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -1869,13 +1869,18 @@ void ivas_spar_dec_upmixer_sf_fx( test(); test(); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + IF( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) && ( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) +#else IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) +#endif { Word16 q_cldfb = 6; move16(); ivas_spar_calc_smooth_facs_fx( cldfb_in_ts_re_fx[0], cldfb_in_ts_im_fx[0], q_cldfb, num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_buf_fx ); } + Word16 sh_l = sub( 31, q1 ); FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { @@ -1888,7 +1893,11 @@ void ivas_spar_dec_upmixer_sf_fx( test(); test(); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + IF( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) && ( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) +#else IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) +#endif { FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { @@ -2031,11 +2040,19 @@ void ivas_spar_dec_upmixer_sf_fx( test(); test(); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + test(); + test(); + IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) ) +#else IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) +#endif { ivas_dirac_dec_render_sf_fx( st_ivas, output_fx, nchan_internal, cldfb_in_ts_re_fx, cldfb_in_ts_im_fx ); } + /*------------------------------------------------------------------ends*/ + IF( st_ivas->hDirAC != NULL ) { Word16 outchannels, idx_in, idx_lfe, ch; diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index edc45174ecfeb49864c8951cc7d5c6bb73a2e87a..cab884050a9b3a5d9dd947a9e01e1c0168e1234c 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -1083,6 +1083,9 @@ ivas_error ivas_cpe_enc_fx( IF( EQ_32( sts[0]->core_brate, SID_2k40 ) ) { +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + ivas_write_format_sid_fx( ivas_format, hCPE->element_mode, sts[0]->hBstr, hEncoderConfig->sba_order, hEncoderConfig->sba_planar ); +#else ivas_write_format_sid_fx( ivas_format, hCPE->element_mode, sts[0]->hBstr ); #ifdef NONBE_FIX_1052_SBA_EXT IF( EQ_32( ivas_format, SBA_FORMAT ) ) @@ -1093,6 +1096,7 @@ ivas_error ivas_cpe_enc_fx( /* Write SBA order */ push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS ); } +#endif #endif } diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index b6b41b8478214cae2b3017abf60bbbfaa54bc91a..bc1f65c9557fa47f8fb06bc383054cd3b716d536 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -322,7 +322,7 @@ ivas_error ivas_dirac_enc_fx( const Word16 dtx_vad, /* i : DTX vad flag Q0*/ const IVAS_FORMAT ivas_format, /* i : ivas format */ #ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_transport, /* i : number of transport channels */ #endif const Word16 hodirac_flag, /* i : hodirac flag Q0*/ const Word16 shift ) diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 3f5b8f8636e8870bd1ba4c480dddd51adba9fc39..8c41a62fb83eb513dd5f48487c217e3574120d37 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -153,7 +153,13 @@ void ivas_write_format_fx( void ivas_write_format_sid_fx( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 element_mode, /* i : element bitrate Q0*/ - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 sba_planar /* i : SBA planar flag */ +#else + BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ +#endif ) { Word16 ind = 0; /* to avoid compilation warning */ @@ -220,6 +226,17 @@ void ivas_write_format_sid_fx( push_indice( hBstr, IND_IVAS_FORMAT, ind, SID_FORMAT_NBITS ); +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + IF( EQ_32( ivas_format, SBA_FORMAT ) ) + { + /* Write SBA planar flag */ + push_indice( hBstr, IND_SMODE, sba_planar, SBA_PLANAR_BITS ); + + /* Write SBA order */ + push_indice( hBstr, IND_SMODE, sba_order, SBA_ORDER_BITS ); + } +#endif + return; } diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 3e7d8afcd71851e989044b64fe03ef9c50d05bbd..506f9ee395711378cb10907749b0dfcffb00af8e 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -383,7 +383,12 @@ ivas_error ivas_ism_enc_fx( IF( sid_flag ) { + +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + ivas_write_format_sid_fx( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr, -1, -1 ); +#else ivas_write_format_sid_fx( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); +#endif } /*only metadata encoding is needed for this case*/ diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index facbde22f370bd837c0144ad58b5517a34ef3c6d..ba658b31acc7fee19605bb817c7595d080e36499 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -868,7 +868,7 @@ void ivas_qmetadata_enc_sid_encode_fx( IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure */ #ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nchan_transport, /* i : number of transport channels */ #endif const Word16 ivas_format /* i : IVAS format */ ) diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 5ff9878b2d99f2f8e13df7bb32ef17cc53fed36f..c74a1f5e16524f35e1874c9edec227df01519f39 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -309,6 +309,9 @@ ivas_error ivas_sce_enc_fx( IF( EQ_32( st->core_brate, SID_2k40 ) ) { +#ifdef NONBE_FIX_1052_SBA_EXT_FIX + ivas_write_format_sid_fx( ivas_format, IVAS_SCE, st->hBstr, st_ivas->hEncoderConfig->sba_order, st_ivas->hEncoderConfig->sba_planar ); +#else ivas_write_format_sid_fx( ivas_format, IVAS_SCE, st->hBstr ); #ifdef NONBE_FIX_1052_SBA_EXT IF( EQ_32( ivas_format, SBA_FORMAT ) ) @@ -319,6 +322,7 @@ ivas_error ivas_sce_enc_fx( /* Write SBA order */ push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS ); } +#endif #endif } diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 954ca5149c6485f78290defcd524144549a30374..14f8acba6673d6d5e2113b0b064a090096f462fe 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -1715,6 +1715,7 @@ static void ivas_write_parameter_bitstream_dtx_fx( #ifdef NONBE_FIX_1052_SBA_EXT Word16 sba_spar_bitlen; #endif + sid_bits_len = hMetaData->nb_bits_tot; move16(); pr_min_max[0] = pSpar_md->min_max_fx[0]; @@ -1796,6 +1797,7 @@ static void ivas_write_parameter_bitstream_dtx_fx( #else zero_pad_bits = sub( i_mult( SPAR_DTX_BANDS, SPAR_SID_BITS_TAR_PER_BAND ), sid_bits_len ); #endif + assert( zero_pad_bits >= 0 ); IF( EQ_16( num_dmx[0], 2 ) ) {