Loading lib_com/ivas_cnst.h +4 −0 Original line number Diff line number Diff line Loading @@ -270,7 +270,11 @@ typedef enum #define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */ #define SID_ISM 0x2 /* 0| 1| 0 */ #define SID_MASA_1TC 0x3 /* 1| 1| 0 */ #ifdef FIX_1209_SID_SIGNALING /*reserved*/ /*0x4*/ /* 0| 0| 1 */ #else #define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */ #endif #define SID_SBA_1TC 0x5 /* 1| 0| 1 */ #define SID_SBA_2TC 0x6 /* 0| 1| 1 */ #define SID_MASA_2TC 0x7 /* 1| 1| 1 */ Loading lib_com/ivas_prot_fx.h +2 −5 Original line number Diff line number Diff line Loading @@ -4034,7 +4034,6 @@ void ivas_syn_output_f_fx( Word32 *synth_out /* o : integer 16 bits synthesis signal */ ); ivas_error ivas_init_encoder_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); Loading @@ -4045,10 +4044,8 @@ ivas_error ivas_output_buff_dec_fx( const Word16 nchan_out_buff /* i : number of output channels */ ); /*! r: flag to indicate if split rendering is enabled */ Word16 is_split_rendering_enabled( const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* i : Render config data structure */ ivas_error ivas_dec_get_format_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error ivas_dec_setup( Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,7 @@ #define NONBE_1360_LFE_DELAY /* Dlb: LFE delay alignment when rendering in CLDFB domain*/ #define NONBE_1229_FIX_ISM1_DPID /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */ #define NONBE_SVD_OPTIMIZATION #define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ /* #################### End BASOP porting switches ############################ */ Loading lib_dec/ivas_init_dec_fx.c +444 −7 Original line number Diff line number Diff line Loading @@ -110,6 +110,431 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_orde } #endif #ifdef FIX_1209_SID_SIGNALING /*---------------------------------------------------------------------* * ivas_dec_get_format_fx( ) * * Read main parameters from the bitstream to set-up the decoder: * - IVAS format * - IVAS format specific signaling *---------------------------------------------------------------------*/ ivas_error ivas_dec_get_format_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { Word16 k, idx, num_bits_read; Word16 nchan_ism, element_mode_flag; Word16 sba_order, sba_planar, sba_analysis_order; Word32 ivas_total_brate; UWord16 *bit_stream_orig; AUDIO_CONFIG signaled_config; ivas_error error; num_bits_read = 0; move16(); element_mode_flag = 0; move16(); ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); bit_stream_orig = st_ivas->bit_stream; /*-------------------------------------------------------------------* * Read IVAS format *-------------------------------------------------------------------*/ IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) { return error; } test(); test(); test(); test(); test(); IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->ivas_format, st_ivas->last_ivas_format ) && !( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_ISM_FORMAT ) ) && !( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_FORMAT ) ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } /*-------------------------------------------------------------------* * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( is_DTXrate( ivas_total_brate ) == 0 ) { /*-------------------------------------------------------------------* * Read IVAS format related signaling: * - in ISM : read number of objects * - in SBA : read SBA planar flag and SBA order * - in MASA : read number of TC * - in MC : read LS setup *-------------------------------------------------------------------*/ IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) { element_mode_flag = 1; move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) { /* read the number of objects */ nchan_ism = 1; move16(); WHILE( st_ivas->bit_stream[k - 1] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism = add( nchan_ism, 1 ); k = sub( k, 1 ); } test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); st_ivas->ism_mode = ivas_ism_mode_select( nchan_ism, ivas_total_brate ); st_ivas->nchan_transport = nchan_ism; move16(); if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; move16(); } } ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) { /* read Ambisonic (SBA) planar flag */ sba_planar = st_ivas->bit_stream[num_bits_read]; num_bits_read = add( num_bits_read, SBA_PLANAR_BITS ); test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_planar, st_ivas->sba_planar ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA planar/3D layout is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA planar flag signalled!" ); } /* read Ambisonic (SBA) order */ sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); sba_order = add( sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) ); test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); } sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order ); st_ivas->nchan_transport = ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_analysis_order ); } ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) { /* read number of MASA transport channels */ IF( st_ivas->bit_stream[k - 1] ) { st_ivas->nchan_transport = 2; move16(); element_mode_flag = 1; move16(); } ELSE { st_ivas->nchan_transport = 1; move16(); } /* this should be non-zero if original input format was MASA_ISM_FORMAT */ st_ivas->ism_mode = ISM_MODE_NONE; move16(); nchan_ism = st_ivas->bit_stream[k - 3] + shl( st_ivas->bit_stream[k - 2], 1 ); IF( nchan_ism > 0 ) { /* 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 */ nchan_ism = sub( 5, nchan_ism ); test(); IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( st_ivas->nchan_ism, 2 ) ) { st_ivas->nchan_ism = 1; move16(); } /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/ st_ivas->nchan_transport = 2; move16(); element_mode_flag = 1; move16(); } test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ move16(); /* the number of objects are written at the end of the bitstream */ nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 ); st_ivas->ism_mode = ivas_omasa_ism_mode_select_fx( ivas_total_brate, nchan_ism ); test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { /* the number of objects is written at the end of the bitstream, in the SBA metadata */ nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 ); test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); /* read Ambisonic (SBA) planar flag */ /*sba_planar = st_ivas->bit_stream[num_bits_read];*/ num_bits_read = add( num_bits_read, SBA_PLANAR_BITS ); /* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/ sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 ); num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); /* read the real Ambisonic order when the above bits are used to signal OSBA format */ IF( LT_32( ivas_total_brate, IVAS_24k4 ) ) { sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 ); num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); } test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); } st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order ); st_ivas->nchan_transport = ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_analysis_order ); } ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { /* read MC configuration */ idx = 0; move16(); FOR( k = 0; k < MC_LS_SETUP_BITS; k++ ) { IF( st_ivas->bit_stream[num_bits_read + k] ) { idx = add( idx, shl( 1, sub( ( MC_LS_SETUP_BITS - 1 ), k ) ) ); } } num_bits_read = add( num_bits_read, MC_LS_SETUP_BITS ); signaled_config = ivas_mc_map_ls_setup_to_output_config_fx( idx ); test(); IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->transport_config, signaled_config ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" ); } st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); st_ivas->transport_config = signaled_config; move16(); } /*-------------------------------------------------------------------* * Read element mode *-------------------------------------------------------------------*/ test(); IF( st_ivas->ini_frame == 0 && element_mode_flag ) { /* read stereo technology info */ if ( LT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { /* 1 bit */ IF( st_ivas->bit_stream[num_bits_read] ) { st_ivas->element_mode_init = add( 1, IVAS_CPE_DFT ); } ELSE { st_ivas->element_mode_init = add( 0, IVAS_CPE_DFT ); } } ELSE { st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); } } } ELSE IF( EQ_32( ivas_total_brate, IVAS_SID_5k2 ) ) { SWITCH( st_ivas->sid_format ) { case SID_DFT_STEREO: st_ivas->element_mode_init = IVAS_CPE_DFT; move16(); BREAK; case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); BREAK; case SID_ISM: st_ivas->element_mode_init = IVAS_SCE; move16(); BREAK; case SID_MASA_1TC: st_ivas->element_mode_init = IVAS_SCE; move16(); st_ivas->nchan_transport = 1; move16(); BREAK; case SID_MASA_2TC: IF( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] == 1 ) { st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); } ELSE { st_ivas->element_mode_init = IVAS_CPE_DFT; move16(); } st_ivas->nchan_transport = 2; move16(); BREAK; case SID_SBA_1TC: st_ivas->element_mode_init = IVAS_SCE; move16(); BREAK; case SID_SBA_2TC: st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); BREAK; } if ( st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ nchan_ism = 1; move16(); WHILE( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism = add( nchan_ism, 1 ); k = sub( k, 1 ); } k = sub( k, 1 ); test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); /* read ism_mode */ st_ivas->ism_mode = ISM_MODE_DISC; move32(); IF( GT_16( nchan_ism, 2 ) ) { k = sub( k, nchan_ism ); /* SID metadata flags */ idx = st_ivas->bit_stream[k]; move16(); st_ivas->ism_mode = (ISM_MODE) add( idx, 1 ); move32(); } st_ivas->nchan_transport = nchan_ism; move16(); if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; move16(); } } } st_ivas->bit_stream = bit_stream_orig; return IVAS_ERR_OK; } #endif /*-------------------------------------------------------------------* * ivas_dec_setup() * Loading @@ -127,6 +552,9 @@ ivas_error ivas_dec_setup( Decoder_State *st; Word32 ivas_total_brate; ivas_error error; Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; move16(); error = IVAS_ERR_OK; move32(); Loading @@ -142,11 +570,14 @@ ivas_error ivas_dec_setup( * Read IVAS format *-------------------------------------------------------------------*/ #ifdef FIX_1209_SID_SIGNALING IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) { return error; } #else ivas_read_format( st_ivas, &num_bits_read ); Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; move16(); #endif /*-------------------------------------------------------------------* * Read other signling (ISM/MC mode, number of channels, etc.) Loading Loading @@ -377,10 +808,11 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ /* read the real Ambisonic order when the above bits are used to signal OSBA format */ if ( LT_32( ivas_total_brate, IVAS_24k4 ) ) IF( LT_32( ivas_total_brate, IVAS_24k4 ) ) { st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; move16(); st_ivas->sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 ); num_bits_read += SBA_ORDER_BITS; } Loading Loading @@ -615,6 +1047,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; move16(); /* read ism_mode */ st_ivas->ism_mode = ISM_MODE_DISC; move32(); Loading Loading @@ -825,10 +1258,12 @@ static ivas_error ivas_read_format( st_ivas->ivas_format = ISM_FORMAT; move32(); BREAK; #ifndef FIX_1209_SID_SIGNALING case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; move32(); BREAK; #endif case SID_SBA_1TC: st_ivas->ivas_format = SBA_FORMAT; move32(); Loading Loading @@ -864,7 +1299,9 @@ static ivas_error ivas_read_format( } BREAK; default: #ifndef FIX_1209_SID_SIGNALING /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } Loading lib_dec/ivas_jbm_dec_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -2651,7 +2651,7 @@ ivas_error ivas_jbm_dec_render_fx( nchan_out_syn_output = nchan_out; move16(); if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) { IF( NE_32( st_ivas->ivas_format, MONO_FORMAT ) ) { Loading Loading @@ -2963,7 +2963,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( move16(); /* Only write out the valid data*/ if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) { IF( NE_16( st_ivas->ivas_format, MONO_FORMAT ) ) { Loading Loading
lib_com/ivas_cnst.h +4 −0 Original line number Diff line number Diff line Loading @@ -270,7 +270,11 @@ typedef enum #define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */ #define SID_ISM 0x2 /* 0| 1| 0 */ #define SID_MASA_1TC 0x3 /* 1| 1| 0 */ #ifdef FIX_1209_SID_SIGNALING /*reserved*/ /*0x4*/ /* 0| 0| 1 */ #else #define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */ #endif #define SID_SBA_1TC 0x5 /* 1| 0| 1 */ #define SID_SBA_2TC 0x6 /* 0| 1| 1 */ #define SID_MASA_2TC 0x7 /* 1| 1| 1 */ Loading
lib_com/ivas_prot_fx.h +2 −5 Original line number Diff line number Diff line Loading @@ -4034,7 +4034,6 @@ void ivas_syn_output_f_fx( Word32 *synth_out /* o : integer 16 bits synthesis signal */ ); ivas_error ivas_init_encoder_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); Loading @@ -4045,10 +4044,8 @@ ivas_error ivas_output_buff_dec_fx( const Word16 nchan_out_buff /* i : number of output channels */ ); /*! r: flag to indicate if split rendering is enabled */ Word16 is_split_rendering_enabled( const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* i : Render config data structure */ ivas_error ivas_dec_get_format_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); ivas_error ivas_dec_setup( Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,7 @@ #define NONBE_1360_LFE_DELAY /* Dlb: LFE delay alignment when rendering in CLDFB domain*/ #define NONBE_1229_FIX_ISM1_DPID /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */ #define NONBE_SVD_OPTIMIZATION #define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ /* #################### End BASOP porting switches ############################ */ Loading
lib_dec/ivas_init_dec_fx.c +444 −7 Original line number Diff line number Diff line Loading @@ -110,6 +110,431 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_orde } #endif #ifdef FIX_1209_SID_SIGNALING /*---------------------------------------------------------------------* * ivas_dec_get_format_fx( ) * * Read main parameters from the bitstream to set-up the decoder: * - IVAS format * - IVAS format specific signaling *---------------------------------------------------------------------*/ ivas_error ivas_dec_get_format_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { Word16 k, idx, num_bits_read; Word16 nchan_ism, element_mode_flag; Word16 sba_order, sba_planar, sba_analysis_order; Word32 ivas_total_brate; UWord16 *bit_stream_orig; AUDIO_CONFIG signaled_config; ivas_error error; num_bits_read = 0; move16(); element_mode_flag = 0; move16(); ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); bit_stream_orig = st_ivas->bit_stream; /*-------------------------------------------------------------------* * Read IVAS format *-------------------------------------------------------------------*/ IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) { return error; } test(); test(); test(); test(); test(); IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->ivas_format, st_ivas->last_ivas_format ) && !( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_ISM_FORMAT ) ) && !( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_FORMAT ) ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } /*-------------------------------------------------------------------* * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( is_DTXrate( ivas_total_brate ) == 0 ) { /*-------------------------------------------------------------------* * Read IVAS format related signaling: * - in ISM : read number of objects * - in SBA : read SBA planar flag and SBA order * - in MASA : read number of TC * - in MC : read LS setup *-------------------------------------------------------------------*/ IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) { element_mode_flag = 1; move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) { /* read the number of objects */ nchan_ism = 1; move16(); WHILE( st_ivas->bit_stream[k - 1] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism = add( nchan_ism, 1 ); k = sub( k, 1 ); } test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); st_ivas->ism_mode = ivas_ism_mode_select( nchan_ism, ivas_total_brate ); st_ivas->nchan_transport = nchan_ism; move16(); if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; move16(); } } ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) { /* read Ambisonic (SBA) planar flag */ sba_planar = st_ivas->bit_stream[num_bits_read]; num_bits_read = add( num_bits_read, SBA_PLANAR_BITS ); test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_planar, st_ivas->sba_planar ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA planar/3D layout is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA planar flag signalled!" ); } /* read Ambisonic (SBA) order */ sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); sba_order = add( sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) ); test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); } sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order ); st_ivas->nchan_transport = ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_analysis_order ); } ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) { /* read number of MASA transport channels */ IF( st_ivas->bit_stream[k - 1] ) { st_ivas->nchan_transport = 2; move16(); element_mode_flag = 1; move16(); } ELSE { st_ivas->nchan_transport = 1; move16(); } /* this should be non-zero if original input format was MASA_ISM_FORMAT */ st_ivas->ism_mode = ISM_MODE_NONE; move16(); nchan_ism = st_ivas->bit_stream[k - 3] + shl( st_ivas->bit_stream[k - 2], 1 ); IF( nchan_ism > 0 ) { /* 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 */ nchan_ism = sub( 5, nchan_ism ); test(); IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( st_ivas->nchan_ism, 2 ) ) { st_ivas->nchan_ism = 1; move16(); } /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/ st_ivas->nchan_transport = 2; move16(); element_mode_flag = 1; move16(); } test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ move16(); /* the number of objects are written at the end of the bitstream */ nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 ); st_ivas->ism_mode = ivas_omasa_ism_mode_select_fx( ivas_total_brate, nchan_ism ); test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { /* the number of objects is written at the end of the bitstream, in the SBA metadata */ nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 ); test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); /* read Ambisonic (SBA) planar flag */ /*sba_planar = st_ivas->bit_stream[num_bits_read];*/ num_bits_read = add( num_bits_read, SBA_PLANAR_BITS ); /* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/ sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 ); num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); /* read the real Ambisonic order when the above bits are used to signal OSBA format */ IF( LT_32( ivas_total_brate, IVAS_24k4 ) ) { sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 ); num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); } test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); } st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order ); st_ivas->nchan_transport = ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_analysis_order ); } ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { /* read MC configuration */ idx = 0; move16(); FOR( k = 0; k < MC_LS_SETUP_BITS; k++ ) { IF( st_ivas->bit_stream[num_bits_read + k] ) { idx = add( idx, shl( 1, sub( ( MC_LS_SETUP_BITS - 1 ), k ) ) ); } } num_bits_read = add( num_bits_read, MC_LS_SETUP_BITS ); signaled_config = ivas_mc_map_ls_setup_to_output_config_fx( idx ); test(); IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->transport_config, signaled_config ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" ); } st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); st_ivas->transport_config = signaled_config; move16(); } /*-------------------------------------------------------------------* * Read element mode *-------------------------------------------------------------------*/ test(); IF( st_ivas->ini_frame == 0 && element_mode_flag ) { /* read stereo technology info */ if ( LT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { /* 1 bit */ IF( st_ivas->bit_stream[num_bits_read] ) { st_ivas->element_mode_init = add( 1, IVAS_CPE_DFT ); } ELSE { st_ivas->element_mode_init = add( 0, IVAS_CPE_DFT ); } } ELSE { st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); } } } ELSE IF( EQ_32( ivas_total_brate, IVAS_SID_5k2 ) ) { SWITCH( st_ivas->sid_format ) { case SID_DFT_STEREO: st_ivas->element_mode_init = IVAS_CPE_DFT; move16(); BREAK; case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); BREAK; case SID_ISM: st_ivas->element_mode_init = IVAS_SCE; move16(); BREAK; case SID_MASA_1TC: st_ivas->element_mode_init = IVAS_SCE; move16(); st_ivas->nchan_transport = 1; move16(); BREAK; case SID_MASA_2TC: IF( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] == 1 ) { st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); } ELSE { st_ivas->element_mode_init = IVAS_CPE_DFT; move16(); } st_ivas->nchan_transport = 2; move16(); BREAK; case SID_SBA_1TC: st_ivas->element_mode_init = IVAS_SCE; move16(); BREAK; case SID_SBA_2TC: st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); BREAK; } if ( st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ nchan_ism = 1; move16(); WHILE( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism = add( nchan_ism, 1 ); k = sub( k, 1 ); } k = sub( k, 1 ); test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); } st_ivas->nchan_ism = nchan_ism; move16(); /* read ism_mode */ st_ivas->ism_mode = ISM_MODE_DISC; move32(); IF( GT_16( nchan_ism, 2 ) ) { k = sub( k, nchan_ism ); /* SID metadata flags */ idx = st_ivas->bit_stream[k]; move16(); st_ivas->ism_mode = (ISM_MODE) add( idx, 1 ); move32(); } st_ivas->nchan_transport = nchan_ism; move16(); if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; move16(); } } } st_ivas->bit_stream = bit_stream_orig; return IVAS_ERR_OK; } #endif /*-------------------------------------------------------------------* * ivas_dec_setup() * Loading @@ -127,6 +552,9 @@ ivas_error ivas_dec_setup( Decoder_State *st; Word32 ivas_total_brate; ivas_error error; Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; move16(); error = IVAS_ERR_OK; move32(); Loading @@ -142,11 +570,14 @@ ivas_error ivas_dec_setup( * Read IVAS format *-------------------------------------------------------------------*/ #ifdef FIX_1209_SID_SIGNALING IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) { return error; } #else ivas_read_format( st_ivas, &num_bits_read ); Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; move16(); #endif /*-------------------------------------------------------------------* * Read other signling (ISM/MC mode, number of channels, etc.) Loading Loading @@ -377,10 +808,11 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ /* read the real Ambisonic order when the above bits are used to signal OSBA format */ if ( LT_32( ivas_total_brate, IVAS_24k4 ) ) IF( LT_32( ivas_total_brate, IVAS_24k4 ) ) { st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; move16(); st_ivas->sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 ); num_bits_read += SBA_ORDER_BITS; } Loading Loading @@ -615,6 +1047,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; move16(); /* read ism_mode */ st_ivas->ism_mode = ISM_MODE_DISC; move32(); Loading Loading @@ -825,10 +1258,12 @@ static ivas_error ivas_read_format( st_ivas->ivas_format = ISM_FORMAT; move32(); BREAK; #ifndef FIX_1209_SID_SIGNALING case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; move32(); BREAK; #endif case SID_SBA_1TC: st_ivas->ivas_format = SBA_FORMAT; move32(); Loading Loading @@ -864,7 +1299,9 @@ static ivas_error ivas_read_format( } BREAK; default: #ifndef FIX_1209_SID_SIGNALING /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } Loading
lib_dec/ivas_jbm_dec_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -2651,7 +2651,7 @@ ivas_error ivas_jbm_dec_render_fx( nchan_out_syn_output = nchan_out; move16(); if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) { IF( NE_32( st_ivas->ivas_format, MONO_FORMAT ) ) { Loading Loading @@ -2963,7 +2963,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( move16(); /* Only write out the valid data*/ if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) { IF( NE_16( st_ivas->ivas_format, MONO_FORMAT ) ) { Loading