diff --git a/apps/decoder.c b/apps/decoder.c index c72463750328c22582e0e174df2fc68e84710560..a4ec82dc5380ab61429aaa7b8cefdf11f30c1425 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -156,22 +156,16 @@ typedef struct *------------------------------------------------------------------------------------------*/ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); - static void usage_dec( void ); - #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, uint8_t *splitRendBitsBuf, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif - static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); - #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); - static int16_t app_own_random( int16_t *seed ); - static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif @@ -187,6 +181,12 @@ int main( { bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ DecArguments arg; + ivas_error error = IVAS_ERR_UNKNOWN; +#ifdef SPLIT_REND_WITH_HEAD_ROT + uint8_t splitRendBitsBuf[IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES]; +#endif + + /* Any handles that require cleanup must be declared here and initialized to NULL */ IVAS_DEC_HANDLE hIvasDec = NULL; BS_READER_HANDLE hBsReader = NULL; LsCustomFileReader *hLsCustomReader = NULL; @@ -195,16 +195,12 @@ int main( RotFileReader *externalOrientationFileReader = NULL; RotFileReader *refRotReader = NULL; Vector3PairFileReader *referenceVectorReader = NULL; - ivas_error error = IVAS_ERR_UNKNOWN; + RenderConfigReader *renderConfigReader = NULL; #ifdef FIX_847_OUTPUT_PCM_BUFFER int16_t *pcmBuf = NULL; #else int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT - uint8_t splitRendBitsBuf[IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES]; -#endif - RenderConfigReader *renderConfigReader = NULL; #ifdef DEBUGGING int32_t noClipping; int32_t cnt_frames_limited; @@ -1716,10 +1712,11 @@ static ivas_error initOnFirstGoodFrame( MasaFileWriter **ppMasaWriter, /* o : */ IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS], /* o : */ int16_t *pNumOutChannels, /* o : */ - uint16_t *pNumObj /* o : */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , + uint16_t *pNumObj, /* o : */ SplitFileReadWrite **splitRendWriter +#else + uint16_t *pNumObj /* o : */ #endif ) { @@ -2456,7 +2453,6 @@ static ivas_error decodeG192( #ifdef WMOPS if ( vec_pos_update == 0 ) { - // update_mem(); TODO: verify this update_wmops(); update_mem(); #ifdef MEM_COUNT_DETAILS diff --git a/apps/encoder.c b/apps/encoder.c index b5162a5a025075d6cee4cdbd42f13dde5909b482..9229cc64143e4475f56dd0505f9dc452612093e4 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -131,7 +131,6 @@ typedef struct const char *ca_config_file; bool mimeOutput; IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; - #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode; const char *forcedModeFile; @@ -178,7 +177,7 @@ int main( { bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ EncArguments arg; - int16_t i = 0; + int16_t i; ivas_error error = IVAS_ERR_UNKNOWN; /* Any handles that require cleanup must be declared here and initialized to NULL */ @@ -189,11 +188,7 @@ int main( FILE *f_bwProfile = NULL; JbmFileReader *jbmReader = NULL; MasaFileReader *masaReader = NULL; - IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS]; - for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) - { - ismReaders[i] = NULL; - } + IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL }; int16_t *pcmBuf = NULL; #ifdef DEBUGGING FILE *f_forcedModeProfile = NULL; @@ -234,7 +229,6 @@ int main( goto cleanup; } - /*------------------------------------------------------------------------------------------* * Open output bitstream file *------------------------------------------------------------------------------------------*/ @@ -492,7 +486,6 @@ int main( goto cleanup; } - /* Validate number of channels */ int16_t encInNumChannels = 0; if ( ( error = IVAS_ENC_GetNumInChannels( hIvasEnc, &encInNumChannels ) ) != IVAS_ERR_OK ) @@ -603,7 +596,6 @@ int main( int16_t numSamplesRead = 0; uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME]; uint16_t numBits = 0; - #ifdef DEBUG_SBA #ifdef DEBUG_AGC ivas_open_agc_debug_files( (int16_t) arg.agc ); @@ -725,7 +717,6 @@ int main( } } #endif - /* Read ISM input metadata */ for ( i = 0; i < numIsmInputs; ++i ) { @@ -803,7 +794,6 @@ int main( #ifdef DEBUGGING print_snr(); #endif - /*------------------------------------------------------------------------------------------* * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ @@ -856,7 +846,6 @@ cleanup: print_wmops(); print_mem( NULL ); #endif - #ifdef DEBUGGING dbgclose(); @@ -1606,7 +1595,6 @@ static bool parseCmdlIVAS_enc( usage_enc(); } } - else if ( strcmp( to_upper( argv[i] ), "-ISM_SBA" ) == 0 ) { arg->inputFormat = IVAS_ENC_INPUT_SBA_ISM; @@ -1695,7 +1683,6 @@ static bool parseCmdlIVAS_enc( } } } - else if ( strcmp( argv_to_upper, "-STEREO_DMX_EVS" ) == 0 ) { arg->inputFormat = IVAS_ENC_INPUT_MONO; @@ -1932,7 +1919,6 @@ static void usage_enc( void ) fprintf( stdout, "-mime : Mime output bitstream file format\n" ); fprintf( stdout, " The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" ); fprintf( stdout, " default output bitstream file format is G.192\n" ); - fprintf( stdout, "-bypass mode : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" ); fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index cbb3b860cae34b3ab37cec511d4eb0df4b0c655a..2c7d7c24018ce49e0d22c2aee1d40bd7727c3b99 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -478,10 +478,11 @@ static int16_t getTotalNumInChannels( IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS], IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS], IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS], - IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] #ifdef SPLIT_REND_WITH_HEAD_ROT - , + IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS], IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS] +#else + IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] #endif ) { @@ -586,10 +587,11 @@ static void setupWithSingleFormatInput( CmdlnArgs args, char *audioFilePath, IsmPositionProvider *positionProvider, - MasaFileReader **masaReaders #ifdef SPLIT_REND_WITH_HEAD_ROT - , + MasaFileReader **masaReaders, SplitFileReadWrite **hhSplitRendFileReadWrite +#else + MasaFileReader **masaReaders #endif ) { @@ -605,7 +607,7 @@ static void setupWithSingleFormatInput( exit( -1 ); } - for ( int32_t i = 0; i < args.numInMetadataFiles; ++i ) + for ( int16_t i = 0; i < args.numInMetadataFiles; ++i ) { masaReaders[i] = MasaFileReader_open( args.inMetadataFilePaths[i] ); if ( masaReaders[i] == NULL ) @@ -1847,11 +1849,11 @@ int main( if ( delayNumSamples == -1 ) { - if ( args.delayCompensationEnabled #ifdef SPLIT_REND_WITH_HEAD_ROT - && !is_split_pre_rend_mode( &args ) + if ( args.delayCompensationEnabled && !is_split_pre_rend_mode( &args ) ) +#else + if ( args.delayCompensationEnabled ) #endif - ) { if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) { @@ -3808,11 +3810,12 @@ static void convertInputBuffer( const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, - float *floatBuffer #ifdef SPLIT_REND_WITH_HEAD_ROT - , + float *floatBuffer, const int16_t cldfb_in_flag, IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna +#else + float *floatBuffer #endif ) { @@ -3896,11 +3899,12 @@ static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, - int16_t *intBuffer #ifdef SPLIT_REND_WITH_HEAD_ROT - , + int16_t *intBuffer, const int16_t cldfb_in_flag, IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn +#else + int16_t *intBuffer #endif ) { diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index a8ad216a0e81c6c98926586fd6652d8a13bf9e61..9826da247457911e186fd4a91c08ebbfa24216b5 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -51,13 +51,14 @@ /*! r: delay value in ns */ int32_t get_delay( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t io_fs, /* i : input/output sampling frequency */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t io_fs, /* i : input/output sampling frequency */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , + HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ const AUDIO_CONFIG output_config /* i : decoder output config */ +#else + HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ #endif ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5461f742535d5abfeda27eb2c96545cf7757df17..e7f3bcaa2f87af1187f6ead402346ace1d8a4022 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1081,10 +1081,10 @@ enum #define IVAS_PCA_N1 91 #define IVAS_PCA_N1_EQ ( (IVAS_PCA_N1-1)/2 ) #define IVAS_PCA_BIT_LEN ( 1 + ( IVAS_PCA_QBITS - 1 + IVAS_PCA_QBITS ) ) -#define IVAS_PCA_INTERP 4 /* 4D (Quaternion) dimension */ -#define IVAS_PCA_N_SLOTS 40 //20 +#define IVAS_PCA_INTERP 4 +#define IVAS_PCA_N_SLOTS 40 #define IVAS_PCA_LEN_INTERP_Q ( IVAS_PCA_INTERP * IVAS_PCA_N_SLOTS ) -#define IVAS_PCA_DELAY_CMP 24 // 12 +#define IVAS_PCA_DELAY_CMP 24 #define IVAS_PCA_LEN_INTERP_EIG_DEC ( (IVAS_PCA_N_SLOTS+IVAS_PCA_DELAY_CMP)*16) #define IVAS_PCA_THRES_MIN_DOT 0.8f #define IVAS_PCA_THRES_MIN_DOT2 0.0f diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index e905f9ef102049166e8399d43cd5fe4485a4c6ee..158e05c8bc5af6904141415a94bfb1b14d03e140 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -71,7 +71,6 @@ typedef enum IVAS_ERR_DTX_NOT_SUPPORTED, IVAS_ERR_UNEXPECTED_NULL_POINTER, IVAS_ERR_METADATA_NOT_EXPECTED, - IVAS_ERR_INVALID_SPAR_CONFIG, IVAS_ERR_WRONG_PARAMS, IVAS_ERR_INIT_ERROR, IVAS_ERR_WRONG_MODE, @@ -83,7 +82,6 @@ typedef enum IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_INPUT_FORMAT, IVAS_ERR_INVALID_INDEX, - IVAS_ERR_NOT_SUPPORTED_OPTION, IVAS_ERR_NOT_IMPLEMENTED, IVAS_ERR_WAITING_FOR_BITSTREAM, @@ -136,7 +134,6 @@ typedef enum /*----------------------------------------* * renderer (lib_rend only) * *----------------------------------------*/ - IVAS_ERR_NUM_CHANNELS_UNKNOWN = 0x6000, IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT, IVAS_ERR_INVALID_INPUT_ID, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 543c0adc9d22fb4a43179f6ecd86c6ac1ad95757..d78de4603ab3d2bb4f040806659ecf06679feebe 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -314,8 +314,8 @@ void stereo_dmx_evs_close_encoder( ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif @@ -325,10 +325,10 @@ ivas_error ivas_dec_setup( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ); @@ -670,10 +670,10 @@ ivas_error ivas_mc_dec_config( const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ); @@ -699,9 +699,9 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( ); void smooth_dft2td_transition( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float *output[CPE_CHANNELS], /* i/o: synthesis @external Fs */ - const int16_t output_frame /* i : output frame length */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + float *output[CPE_CHANNELS], /* i/o: synthesis @external Fs */ + const int16_t output_frame /* i : output frame length */ ); #ifdef DEBUG_MODE_INFO @@ -813,14 +813,14 @@ ivas_error ivas_jbm_dec_flush_renderer( const ISM_MODE ism_mode_old, /* i : old ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed */ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ); -ivas_error ivas_jbm_dec_feed_tc_to_renderer( +void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ @@ -857,17 +857,17 @@ int16_t ivas_jbm_dec_get_num_tc_channels( ); void ivas_jbm_dec_copy_tc_no_tsm( - Decoder_Struct *st_ivas, - float *tc[], - const int16_t output_frame + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *tc[], /* i : transport channels */ + const int16_t output_frame /* i : output frame size */ ); void ivas_jbm_dec_get_md_map_even_spacing( - const int16_t len, /* i : length of the modfied frames in metadata slots */ - const int16_t subframe_len, /* i : default length of a subframe */ - const int16_t offset, /* i : current read offset into the md buffer */ - const int16_t buf_len, /* i : length of the metadata buffer */ - int16_t *map /* o : metadata index map */ + const int16_t len, /* i : length of the modfied frames in metadata slots */ + const int16_t subframe_len, /* i : default length of a subframe */ + const int16_t offset, /* i : current read offset into the md buffer */ + const int16_t buf_len, /* i : length of the metadata buffer */ + int16_t *map /* o : metadata index map */ ); TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( @@ -879,7 +879,7 @@ int16_t ivas_jbm_dec_get_render_granularity( const RENDERER_TYPE rendererType, /* i : renderer type */ const IVAS_FORMAT ivas_format, /* i : ivas format */ const MC_MODE mc_mode, /* i : MC mode */ - const int32_t output_Fs /* i : sampling rate */ + const int32_t output_Fs /* i : sampling rate */ ); ivas_error ivas_jbm_dec_tc_buffer_open( @@ -1083,10 +1083,10 @@ ivas_error ivas_ism_dec_config( const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ); @@ -1116,10 +1116,10 @@ void ivas_param_ism_dec_digest_tc( ); void ivas_ism_param_dec_tc_gain_ajust( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamples, /* i : number of samples to be compensate */ - const uint16_t nFadeLength, /* i : length of the crossfade in samples */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamples, /* i : number of samples to be compensate */ + const uint16_t nFadeLength, /* i : length of the crossfade in samples */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); void ivas_param_ism_dec_render( @@ -1175,8 +1175,8 @@ void ivas_ism_metadata_sid_enc( ); void ivas_ism_metadata_sid_dec( - SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const int32_t ism_total_brate, /* i : ISms total bitrate */ + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE decoder structure */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t bfi, /* i : bfi flag */ const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -1222,7 +1222,7 @@ void ivas_get_ism_sid_quan_bitbudget( ); void ivas_ism_dtx_limit_noise_energy_for_near_silence( - SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ); @@ -2490,7 +2490,7 @@ void IGFDecApplyStereo( const int16_t *coreMsMask, const int16_t restrict_hopsize, const int16_t bfi, /* i : frame loss == 1, frame good == 0 */ - const int16_t bfi_apply_damping /* i : decoder element mode */ + const int16_t bfi_apply_damping /* i : decoder element mode */ ); void IGFEncStereoEncoder( @@ -3136,7 +3136,7 @@ void ivas_mct_dec_mct( void apply_MCT_dec( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ Decoder_State **sts, /* i/o: decoder state structure */ - float *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ + float *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ ); void mctStereoIGF_dec( @@ -3470,12 +3470,12 @@ ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifdef JBM_FOR_OSBA , - uint16_t *nSamplesFlushed, /* o : number of samples flushed */ -#if defined SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + uint16_t *nSamplesFlushed, /* o : number of samples flushed */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif #endif ); @@ -3621,11 +3621,11 @@ ivas_error ivas_dirac_enc( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ float *data_f[], /* i/o: SBA channels */ - float **ppIn_FR_real, /* o : real freq domain values */ - float **ppIn_FR_imag, /* o : imag freq domain values */ - 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 */ + float **ppIn_FR_real, /* o : real freq domain values */ + float **ppIn_FR_imag, /* o : imag freq domain values */ + 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 */ const int16_t hodirac_flag /* i : hodirac flag */ ); @@ -3676,7 +3676,7 @@ void ivas_dirac_dec_read_BS( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial rendering data handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q metadata */ int16_t *nb_bits, /* o : number of bits read */ - const int16_t last_bit_pos, /* i : last read bitstream position*/ + const int16_t last_bit_pos, /* i : last read bitstream position */ const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -3811,18 +3811,18 @@ void ivas_mc_paramupmix_dec_read_BS( ); void ivas_mc_paramupmix_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - const int16_t nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const int16_t nSamplesForRendering /* i : number of samples provided */ ); void ivas_mc_paramupmix_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ - uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ - uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *input_f[], /* i : core-coder transport channels */ - float *output_f[] /* i/o: synthesized core-coder transport channels */ + float *output_f[] /* i/o: synthesized core-coder transport channels */ ); void ivas_param_mc_metadata_open( @@ -4164,7 +4164,7 @@ ivas_error ivas_sba_linear_renderer( float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ - const int16_t nchan_ism, + const int16_t nchan_ism, /* i : number of objects */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ ); @@ -4182,9 +4182,9 @@ void ivas_sba_mix_matrix_determiner( /*! r: AGC enable flag */ int16_t ivas_agc_enc_get_flag( #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - int16_t agc_configuration, /* i : AGC configuration from command-line */ + const int16_t agc_configuration, /* i : AGC configuration from command-line */ #endif - int16_t nchan_transport /* i : number of transport channels */ + const int16_t nchan_transport /* i : number of transport channels */ ); ivas_error ivas_spar_agc_enc_open( @@ -4368,7 +4368,7 @@ void ivas_spar_dec_digest_tc( const int16_t nSamplesForRendering /* i : number of samples provided */ ); -ivas_error ivas_sba_dec_digest_tc( +void ivas_sba_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nCldfbSlots, /* i : number of CLDFB slots */ const int16_t nSamplesForRendering /* i : number of samples provided */ @@ -4379,7 +4379,7 @@ ivas_error ivas_sba_dec_render( const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ + float *output_f[] /* o : rendered time signal */ ); void ivas_spar_dec_upmixer_sf( @@ -4416,8 +4416,8 @@ ivas_error ivas_spar_md_enc_process( const int16_t nchan_inp, const int16_t sba_order, /* i : Ambisonic (SBA) order */ float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */ - const int16_t dyn_active_w_flag, /* i : flag to indicate dynamic active W */ - const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ + const int16_t dyn_active_w_flag, /* i : flag to indicate dynamic active W */ + const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ ); void ivas_compute_spar_params( @@ -4489,13 +4489,13 @@ int16_t ivas_get_spar_dec_md_num_subframes( ); ivas_error ivas_spar_md_dec_matrix_open( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels, /* i : number of internal channels */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels, /* i : number of internal channels */ const int16_t num_md_sub_frames ); void ivas_spar_md_dec_matrix_close( - ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ const int16_t num_channels /* i : number of internal channels */ ); @@ -4550,7 +4550,7 @@ void ivas_spar_update_md_hist( ); int16_t ivas_spar_chk_zero_coefs( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_spar_smooth_md_dtx( @@ -5003,10 +5003,10 @@ ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ); @@ -5224,11 +5224,11 @@ void ivas_binRenderer_close( ); void ivas_binaural_hrtf_close( - HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ ); void ivas_init_binaural_hrtf( - HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ ); ivas_error ivas_allocate_binaural_hrtf( @@ -5553,6 +5553,11 @@ ivas_error ivas_mono_dmx_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); + +void ivas_mono_dmx_renderer_close( + MONO_DOWNMIX_RENDERER_HANDLE *hMonoDmxRenderer /* i/ i/o: Mono downmix structure */ +); + void ivas_mono_downmix_render_passive( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/mono output */ @@ -5681,15 +5686,14 @@ ivas_error ivas_osba_enc_reconfig( ); void ivas_osba_enc( - OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - float *data_in_f[], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ - const int16_t sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ - const int32_t input_Fs /* i : input sampling rate */ - , + OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + float *data_in_f[], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_ism, /* i : Number of objects for parameter analysis*/ + const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t sba_analysis_order, /* i : SBA order evaluated in SBA encoder */ + const int32_t input_Fs, /* i : input sampling rate */ const int16_t sba_planar /* i : planar SBA flag */ ); @@ -5697,18 +5701,16 @@ ivas_error ivas_osba_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); - #ifdef JBM_FOR_OSBA ivas_error ivas_osba_dirac_td_binaural_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ - uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ - uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ ); #endif - ivas_error ivas_osba_dirac_td_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* o : output synthesis signal */ @@ -5729,7 +5731,7 @@ ivas_error ivas_osba_render( ); void ivas_osba_data_close( - SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ + SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); @@ -5753,10 +5755,10 @@ ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ #ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ); @@ -5872,12 +5874,12 @@ ivas_error ivas_omasa_dirac_td_binaural( ); ivas_error ivas_omasa_dirac_td_binaural_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamplesAsked, /* i : number of samples requested */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailable, /* o : number of samples still to render */ - const int16_t nchan_transport, /* i : number of transport channels */ - float *output_f[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of samples requested */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + uint16_t *nSamplesAvailable, /* o : number of samples still to render */ + const int16_t nchan_transport, /* i : number of transport channels */ + float *output_f[] /* o : rendered time signal */ ); void ivas_omasa_dirac_rend( @@ -5893,12 +5895,12 @@ void ivas_omasa_rearrange_channels( ); void ivas_omasa_dirac_rend_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamplesAsked, /* i : number of samples requested */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailable, /* o : number of samples still to render */ - const int16_t nchan_transport, /* i : number of transport channels */ - float *output_f[] /* o : rendered time signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of samples requested */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + uint16_t *nSamplesAvailable, /* o : number of samples still to render */ + const int16_t nchan_transport, /* i : number of transport channels */ + float *output_f[] /* o : rendered time signal */ ); void ivas_omasa_preProcessStereoTransportsForMovedObjects( @@ -5925,11 +5927,11 @@ void ivas_omasa_separate_object_render( ); void ivas_omasa_separate_object_render_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t nSamplesRendered, /* i : number of samples rendered */ - float *output_f[], /* o : rendered time signal */ - const int16_t subframes_rendered, /* i : number of subframes rendered */ - const int16_t slots_rendered /* i : number of CLDFB slots rendered */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesRendered, /* i : number of samples rendered */ + float *output_f[], /* o : rendered time signal */ + const int16_t subframes_rendered, /* i : number of subframes rendered */ + const int16_t slots_rendered /* i : number of CLDFB slots rendered */ ); void ivas_omasa_encode_masa_to_total( @@ -6040,13 +6042,13 @@ void ivas_fb_mixer_get_in_out_mapping( ); void ivas_fb_mixer_cross_fading( - IVAS_FB_MIXER_HANDLE hFbMixer, - float **ppOut_pcm, - float *pMdft_out_old, - float *pMdft_out_new, - const int16_t ch, - const int16_t frame_len, - const int16_t cf_offset + IVAS_FB_MIXER_HANDLE hFbMixer, + float **ppOut_pcm, + float *pMdft_out_old, + float *pMdft_out_new, + const int16_t ch, + const int16_t frame_len, + const int16_t cf_offset ); /*! r: number of spectral bands */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 06232fe64e79a130d8b16a6091c199efad8519d3..50892fcf53e2ceea0c6a45e07c042494e79a1b0a 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -887,63 +887,63 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = { /* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */ - { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } }, + { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } }, { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, - { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } }, - { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, + { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } }, + { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, - { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 14850, 24350 } }, + { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 16400, 14850, 24350 } }, { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, - { 32000, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,{ { 24000, 20450, 31950 } }, + { 32000, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 24000, 20450, 31950 } }, { { 21, 1, 5, 1 },{ 15, 1, 5, 1 },{ 15, 1, 3, 1 } }, 0, 0, 0 }, - { 48000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0,{ { 24000, 21000, 31950 },{ 16000, 15000, 20400 } }, + { 48000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 24000, 21000, 31950 },{ 16000, 15000, 20400 } }, { { 15, 7, 5, 1 },{ 15, 7, 3, 1 },{ 7, 7, 3, 1 } }, 1, 0, 0 }, - { 64000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0,{ { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 1, 0 }, + { 64000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 1, 0 }, - { 80000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0,{ { 46000, 43000, 56000 },{ 24000, 23000, 31950 } }, + { 80000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 46000, 43000, 56000 },{ 24000, 23000, 31950 } }, { { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 0, 0 }, - { 96000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0,{ { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } }, + { 96000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } }, { { 21, 9, 9, 1 },{ 21, 7, 5, 1 },{ 21, 7, 5, 1 } }, 1, 0, 0 }, - { 128000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0,{ { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } }, + { 128000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } }, { { 21, 11, 9, 1 },{ 21, 9, 7, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 }, - { 160000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0,{ { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } }, + { 160000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } }, { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 }, - { 192000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0,{ { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } }, + { 192000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } }, { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 }, - { 256000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } }, + { 256000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } }, { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 256000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } }, + { 256000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } }, + { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, 1, 2, 0 }, - { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } }, // not yet optimized + { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } }, { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } }, // just added as a place holder, not necessarily operational + { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } }, // just added as a place holder, not necessarily operational + { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } }, // not yet optimized + { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } }, { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } }, // not yet optimized + { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, - { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } }, // not yet optimized + { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, }; diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index ba3fd9b995c3188fdbd4ab11e20b19798e661b2e..f519ffec13a175a79850ee18d8469b6f1a0f66f0 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -943,7 +943,7 @@ static void ivas_calc_p_coeffs_per_band( { if ( i == j ) { - pSparMd->band_coeffs[b_ts_idx].P_re[j - num_dmx] = cov_uu_re[i - num_dmx][j - num_dmx]; // can optimise here + pSparMd->band_coeffs[b_ts_idx].P_re[j - num_dmx] = cov_uu_re[i - num_dmx][j - num_dmx]; } } } diff --git a/lib_com/options.h b/lib_com/options.h index 73464a5c15775ad0ef096fa1aab4107a78d6cf3e..41ed34b2f72e42485a91a9d555fcfe7e2ff002b0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,7 +168,7 @@ /* #################### End BE switches ################################## */ -#define BE_FIX_832_ASAN_ERROR_EFAP_OSBA /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/ + /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt selection floating point code */ @@ -187,6 +187,9 @@ #define NONBE_FIX_835_JBM_PARAMUPMIX_HEADROT /* FhG: issue #835: Resolve "JBM: ParamUpmix head rotation broken" */ #define NONBE_FIX_838_CRASH_24_4_WB /* FhG: Issue 838: fix encoder crashes for Unified Stereo and MASA 2 TC at 24.4 kbps WB due to missing IGF (re-) allocation */ #define NONBE_FIX_839_MC_RS_CHANNEL_ALLOC /* FhG: Issues #839: problems with reallocation of the channels on the heap in case of MC RS */ +#define BE_FIX_832_ASAN_ERROR_EFAP_OSBA /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/ + + /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 30274b8feaaa27c90a185fe776461e4c86122617..d3884cbf4f6a7d352cd8baa295f987d31897732c 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2553,7 +2553,7 @@ void GenShapedSHBExcitation( float *shb_res_gshape, /* i : SHB LP residual gain shape */ float *shb_res, /* i : SHB residual used in encoder only */ int16_t *vf_ind, /* i/o: Mixing factor index */ - const float formant_fac, /* i : Formant sharpening factor [0..1] */ + const float formant_fac, /* i : Formant sharpening factor [0..1] */ float fb_state_lpc_syn[], /* i/o: memory */ float *fb_tbe_demph, /* i/o: fb de-emphasis memory */ const int32_t total_brate, /* i : overall bitrate */ @@ -6545,7 +6545,7 @@ void hq_ecu( const int16_t old_is_transient[2], /* i : flags indicating previous transient frames*/ float *mag_chg_1st, /* i/o: per band magnitude modifier for transients*/ float Xavg[LGW_MAX], /* i/o: Frequency group average gain to fade to */ - float *beta_mute, /* o : Factor for long-term mute */ + float *beta_mute, /* o : Factor for long-term mute */ const int16_t output_frame, /* i : frame length */ Decoder_State *st /* i/o: decoder state structure */ ); diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 71c0c6b728efa9d29ea04adfdf62657df1170b8c..28cafd4732873ca9a7a07ef576ad50954287bac7 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -2158,7 +2158,7 @@ void hq_ecu( const int16_t old_is_transient[2], /* i : flags indicating previous transient frames*/ float *mag_chg_1st, /* i/o: per band magnitude modifier for transients*/ float Xavg[LGW_MAX], /* i/o: Frequency group average gain to fade to */ - float *beta_mute, /* o : Factor for long-term mute */ + float *beta_mute, /* o : Factor for long-term mute */ const int16_t output_frame, /* i : frame length */ Decoder_State *st /* i/o: decoder state structure */ ) diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index 2a642d26471e0fc80a937e688fec01f0cfaa6be7..b7885d35b4cb8d04a771a46d7f11e8fa7cf04c1c 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -81,12 +81,12 @@ static void find_enr_dct( const float data[], float band[], float *ptE, float *E *------------------------------------------------------------------------*/ void LD_music_post_filter( - MUSIC_POSTFILT_HANDLE hMusicPF, /* i/o: LD music postfilter handle */ - const float dtc_in[], /* i : input synthesis */ - float dtc_out[], /* o : output synthesis */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t coder_type, /* i : Coder type : -1 in case of IO */ - const int16_t Last_coder_type /* i : last Coder type */ + MUSIC_POSTFILT_HANDLE hMusicPF, /* i/o: LD music postfilter handle */ + const float dtc_in[], /* i : input synthesis */ + float dtc_out[], /* o : output synthesis */ + const int32_t core_brate, /* i : core bitrate */ + const int16_t coder_type, /* i : Coder type : -1 in case of IO */ + const int16_t Last_coder_type /* i : last Coder type */ ) { float DCT_buf[DCT_L_POST]; diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 6c79c87842b5949ef7c78db2d57f4d2c11392bb0..d427bf249fb96ac61125d4997a4331851d8a3967 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -64,10 +64,11 @@ static void ivas_binRenderer_filterModule( float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : real part of LS signals */ float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : imag part of LS signals */ const int16_t numTimeSlots, /* i : number of time slots to process */ - BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , - const int16_t pos_idx + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ + const int16_t pos_idx /* i : pose index */ +#else + BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ #endif ) { @@ -140,10 +141,11 @@ static ivas_error ivas_binRenderer_convModuleOpen( const int16_t renderer_type, const int16_t isLoudspeaker, const AUDIO_CONFIG input_config, - const HRTFS_FASTCONV_HANDLE hHrtf #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const HRTFS_FASTCONV_HANDLE hHrtf, const int16_t num_poses +#else + const HRTFS_FASTCONV_HANDLE hHrtf #endif ) { @@ -1290,10 +1292,11 @@ ivas_error ivas_binRenderer_open( *------------------------------------------------------------------------*/ static void ivas_binRenderer_convModuleClose( - BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , - const int16_t num_poses + BINAURAL_RENDERER_HANDLE *hBinRenderer, /* i/o: fastconv binaural renderer handle */ + const int16_t num_poses /* i : number of poses */ +#else + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ #endif ) { @@ -1996,8 +1999,8 @@ void ivas_binRenderer( Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; - QuatToRotMat( Quaternions_rel, Rmat_local ); + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { rotateFrame_sd_cldfb( Rmat_local, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 8f928cdc29ac0e3d747f0bcaf520643f383b933f..a38645242bfdd3764a73239fbf6bcc8685181573 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -465,7 +465,6 @@ ivas_error ivas_dec( int16_t nchan_ism, nchan_transport_ism; int16_t dirac_bs_md_write_idx; - st = st_ivas->hCPE[0]->hCoreCoder[0]; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ @@ -482,7 +481,7 @@ ivas_error ivas_dec( } /* MASA metadata decoding */ - if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_masa_decode( st_ivas, st_ivas->hCPE[0]->hCoreCoder[0], &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } @@ -490,7 +489,7 @@ ivas_error ivas_dec( /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); - st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); + st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); /* set ISM parameters and decode ISM metadata in OMASA format */ if ( ( error = ivas_omasa_ism_metadata_dec( st_ivas, ism_total_brate, &nchan_ism, &nchan_transport_ism, dirac_bs_md_write_idx, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) @@ -595,7 +594,6 @@ ivas_error ivas_dec( /* core-decoding of transport channels */ if ( st_ivas->nSCE == 1 ) { - st = st_ivas->hSCE[0]->hCoreCoder[0]; if ( ( error = ivas_sce_dec( st_ivas, 0, &p_output[0], output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { return error; @@ -603,7 +601,6 @@ ivas_error ivas_dec( } else if ( st_ivas->nCPE == 1 ) { - st = st_ivas->hCPE[0]->hCoreCoder[0]; if ( ( error = ivas_cpe_dec( st_ivas, 0, p_output, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { return error; @@ -611,7 +608,6 @@ ivas_error ivas_dec( } else if ( st_ivas->nCPE > 1 ) { - st = st_ivas->hCPE[0]->hCoreCoder[0]; if ( ( error = ivas_mct_dec( st_ivas, p_output, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { return error; @@ -740,7 +736,6 @@ ivas_error ivas_dec( #ifdef JBM_FOR_OSBA if ( ( error = ivas_sba_upmixer_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &p_output[sba_ch_idx], output_frame ) ) != IVAS_ERR_OK ) #endif { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index e23a4171db604ad9f62045f5f3151f144cf8cfea..990e677e408ebbbff7f5c54db5af742b62fdfa45 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2380,7 +2380,6 @@ void ivas_dirac_dec_render_sf( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - #ifdef OSBA_ROOM_IR /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) @@ -2395,6 +2394,7 @@ void ivas_dirac_dec_render_sf( int16_t n_samples_to_render; int16_t interp_offset; float gain, prev_gain; + num_objects = st_ivas->nchan_ism; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; @@ -2403,9 +2403,7 @@ void ivas_dirac_dec_render_sf( if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) { - ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, - n_samples_to_render, - st_ivas->hIsmRendererData->interpolator ); + ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator ); interp_offset = 0; } @@ -2467,7 +2465,6 @@ void ivas_dirac_dec_render_sf( } #endif - #ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 12dcf0a127ae806dfa8aa2d4d40e9d52c713f212..ed6f317f77789051d581e38b712b64a0ab0b57bb 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -363,12 +363,11 @@ ivas_error ivas_dec_setup( #ifdef JBM_FOR_OSBA , nSamplesRendered, -#if defined SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data #endif - ) ) != IVAS_ERR_OK ) { return error; @@ -481,14 +480,13 @@ ivas_error ivas_dec_setup( /* set Ambisonic (SBA) order used for analysis and coding */ st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); #endif - if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate ) { if ( ( error = ivas_sba_dec_reconfigure( st_ivas #ifdef JBM_FOR_OSBA , nSamplesRendered, -#if defined SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data @@ -504,6 +502,7 @@ ivas_error ivas_dec_setup( /* set Ambisonic (SBA) order used for analysis and coding */ st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); #endif + ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); /*correct number of CPEs for discrete ISM coding*/ @@ -632,7 +631,7 @@ ivas_error ivas_dec_setup( #ifdef JBM_FOR_OSBA , nSamplesRendered, -#if defined SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data @@ -641,6 +640,7 @@ ivas_error ivas_dec_setup( { return error; } + st_ivas->last_active_ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; } @@ -1972,7 +1972,6 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -1986,7 +1985,6 @@ ivas_error ivas_init_decoder( } } - if ( st_ivas->hDecoderConfig->Opt_5ms ) { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -2682,12 +2680,8 @@ void ivas_destroy_dec( st_ivas->hLsSetupCustom = NULL; } - /* Downmix structure */ - if ( st_ivas->hMonoDmxRenderer != NULL ) - { - free( st_ivas->hMonoDmxRenderer ); - st_ivas->hMonoDmxRenderer = NULL; - } + /* Mono downmix structure */ + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); /* OSBA structure */ ivas_osba_data_close( &st_ivas->hSbaIsmData ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 5378cdf66659c6a4f094c96c141852558bd1fe37..e5132a14a8b2a39170720dd9e61e69216645f2ed 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -154,11 +154,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, #ifdef SPLIT_REND_WITH_HEAD_ROT - pcm_resolution, + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif - data ) ) != IVAS_ERR_OK ) { return error; } @@ -280,15 +280,8 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Close the TD Binaural renderer */ if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - - if ( st_ivas->hHrtfTD != NULL ) - { - st_ivas->hHrtfTD = NULL; - } + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { @@ -372,8 +365,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( } /*-----------------------------------------------------------------* - * Reconfigure TC buffer + * JBM TC buffers *-----------------------------------------------------------------*/ + if ( st_ivas->hDecoderConfig->Opt_5ms ) { int16_t tc_nchan_full_new; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 0cd8cac356a17b39d0bcb3b250194a58c50aaeff..8899696bec571b852630a64aac2b090c80ccae13 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -171,7 +171,7 @@ ivas_error ivas_ism_dtx_dec( *-------------------------------------------------------------------*/ void ivas_ism_dtx_limit_noise_energy_for_near_silence( - SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index cc2c7a8b4605ecaff2e151dd8ec5ab6a08153446..bde79fcb5f43cf8fc8790db25ab4b3b46b8f5316 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -928,8 +928,8 @@ static int16_t decode_radius( *-------------------------------------------------------------------*/ void ivas_ism_metadata_sid_dec( - SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const int32_t ism_total_brate, /* i : ISms total bitrate */ + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE decoder structure */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t bfi, /* i : bfi flag */ const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels*/ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index ba8194abe786f970ee44cf837447c3b73e01fe63..c1ffe5cb20b10c6f16216d964c23569a30f0ca30 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -626,6 +626,7 @@ ivas_error ivas_param_ism_dec_open( } set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); } + if ( st_ivas->hTcBuffer == NULL ) { if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) @@ -666,9 +667,9 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_close( - PARAM_ISM_DEC_HANDLE *hParamIsmDec_out, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ - AUDIO_CONFIG output_config /* i : output audio configuration */ + PARAM_ISM_DEC_HANDLE *hParamIsmDec_out, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ + AUDIO_CONFIG output_config /* i : output audio configuration */ ) { if ( hParamIsmDec_out != NULL && *hParamIsmDec_out != NULL ) @@ -1210,6 +1211,7 @@ void ivas_param_ism_dec_digest_tc( } } } + if ( st_ivas->hDecoderConfig->Opt_tsm || !st_ivas->hDecoderConfig->Opt_5ms ) { /*TODO : FhG to check*/ @@ -1218,9 +1220,7 @@ void ivas_param_ism_dec_digest_tc( for ( ch = 0; ch < nchan_transport; ch++ ) { - /*-----------------------------------------------------------------* - * CLDFB Analysis - *-----------------------------------------------------------------*/ + /* CLDFB Analysis */ for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { if ( st_ivas->hDecoderConfig->Opt_tsm || !st_ivas->hDecoderConfig->Opt_5ms ) @@ -1277,8 +1277,8 @@ void ivas_ism_param_dec_tc_gain_ajust( for ( i = 0; i < nSamples; i++ ) { - ene_tc += transport_channels_f[0][i] * transport_channels_f[0][i] + transport_channels_f[1][i] * transport_channels_f[1][i]; // L*L + R*R - ene_sum += ( transport_channels_f[0][i] + transport_channels_f[1][i] ) * ( transport_channels_f[0][i] + transport_channels_f[1][i] ); // (L+R)*(L+R) + ene_tc += transport_channels_f[0][i] * transport_channels_f[0][i] + transport_channels_f[1][i] * transport_channels_f[1][i]; /* L*L + R*R */ + ene_sum += ( transport_channels_f[0][i] + transport_channels_f[1][i] ) * ( transport_channels_f[0][i] + transport_channels_f[1][i] ); /* (L+R)*(L+R) */ } gain = sqrtf( ene_tc / ( ene_sum + EPSILON ) ); if ( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 1 ) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 33c5c7183a3a5eaa29e21eceb14372d02b92a429..25167ac38166e2c76a39e1ea2718b41acd0c7f8d 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -61,12 +61,11 @@ ivas_error ivas_ism_renderer_open( uint16_t init_interpolator_length; ivas_error error; - error = IVAS_ERR_OK; - if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM renderer\n" ) ); } + #ifdef BE_FIX_832_ASAN_ERROR_EFAP_OSBA if ( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth != NULL && st_ivas->hIntSetup.ls_elevation != NULL && st_ivas->hEFAPdata == NULL ) #else @@ -101,13 +100,12 @@ ivas_error ivas_ism_renderer_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM renderer interpolator\n" ) ); } - for ( i = 0; i < interpolator_length; i++ ) { st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); } - return error; + return IVAS_ERR_OK; } @@ -179,7 +177,6 @@ void ivas_ism_render( set_f( output_f[i], 0.0f, output_frame ); } - for ( i = 0; i < nchan_ism; i++ ) { if ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_STEREO ) @@ -287,7 +284,6 @@ void ivas_ism_render_sf( for ( i = 0; i < num_objects; i++ ) { - /* Combined rotation: rotate the object positions depending the head and external orientations */ if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a937aaeeab319774e1ecf1c9591fd2eed901eb32..1a04da9e8a78dd79a51135027bd9b29db6e9c8ac 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -185,6 +185,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { ivas_mono_downmix_render_passive( st_ivas, p_output, output_frame ); @@ -317,7 +318,6 @@ ivas_error ivas_jbm_dec_tc( int16_t nchan_ism, nchan_transport_ism; int16_t dirac_bs_md_write_idx; - st = st_ivas->hCPE[0]->hCoreCoder[0]; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ @@ -334,7 +334,7 @@ ivas_error ivas_jbm_dec_tc( } /* MASA metadata decoding */ - if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_masa_decode( st_ivas, st_ivas->hCPE[0]->hCoreCoder[0], &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } @@ -342,7 +342,7 @@ ivas_error ivas_jbm_dec_tc( /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); - st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); + st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); /* set ISM parameters and decode ISM metadata in OMASA format */ if ( ( error = ivas_omasa_ism_metadata_dec( st_ivas, ism_total_brate, &nchan_ism, &nchan_transport_ism, dirac_bs_md_write_idx, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) @@ -429,7 +429,6 @@ ivas_error ivas_jbm_dec_tc( /* core-decoding of transport channels */ if ( st_ivas->nSCE == 1 ) { - st = st_ivas->hSCE[0]->hCoreCoder[0]; if ( ( error = ivas_sce_dec( st_ivas, 0, p_output, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { return error; @@ -437,7 +436,6 @@ ivas_error ivas_jbm_dec_tc( } else if ( st_ivas->nCPE == 1 ) { - st = st_ivas->hCPE[0]->hCoreCoder[0]; if ( ( error = ivas_cpe_dec( st_ivas, 0, p_output, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { return error; @@ -445,7 +443,6 @@ ivas_error ivas_jbm_dec_tc( } else if ( st_ivas->nCPE > 1 ) { - st = st_ivas->hCPE[0]->hCoreCoder[0]; if ( ( error = ivas_mct_dec( st_ivas, p_output, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { return error; @@ -461,9 +458,7 @@ ivas_error ivas_jbm_dec_tc( ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &p_output[sba_ch_idx] ); } - ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, - ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, - st_ivas->last_active_ivas_total_brate ) ); + ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); ivas_sba_dirac_stereo_dec( st_ivas, &p_output[sba_ch_idx], output_frame, 0 ); } @@ -508,7 +503,6 @@ ivas_error ivas_jbm_dec_tc( } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { - ivas_mono_downmix_render_passive( st_ivas, p_output, output_frame ); /* add W */ @@ -584,7 +578,7 @@ ivas_error ivas_jbm_dec_tc( } /* Rendering */ - if ( ( st_ivas->renderer_type == RENDERER_MC ) && ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) + if ( st_ivas->renderer_type == RENDERER_MC && ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) { /* Compensate loudness for not doing full upmix */ for ( n = 4; n < 8; n++ ) @@ -765,7 +759,7 @@ ivas_error ivas_jbm_dec_tc( * Feed decoded transport channels and metadata to the IVAS JBM renderer routine *--------------------------------------------------------------------------*/ -ivas_error ivas_jbm_dec_feed_tc_to_renderer( +void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ @@ -775,10 +769,8 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; int16_t n, n_render_timeslots; - ivas_error error; push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" ); - for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) { p_data_f[n] = &data_f[n][0]; @@ -830,10 +822,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( } else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { - if ( ( error = ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); } #ifdef JBM_FOR_OSBA else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -879,10 +868,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } - if ( ( error = ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -905,16 +891,12 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - if ( ( error = ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); } } pop_wmops(); - - return IVAS_ERR_OK; + return; } @@ -933,39 +915,32 @@ ivas_error ivas_jbm_dec_render( const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ #endif ) { int16_t n, nchan_out; int16_t nchan_transport; - float output[MAX_OUTPUT_CHANNELS #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + float output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; /* 'float' buffer for output synthesis */ +#else + float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis */ #endif - ][L_FRAME48k]; /* 'float' buffer for output synthesis */ - int16_t nchan_remapped; int32_t output_Fs; AUDIO_CONFIG output_config; int16_t nSamplesAskedLocal; ivas_error error; - - float *p_output[MAX_OUTPUT_CHANNELS #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS -#endif - ]; - float *p_tc[MAX_TRANSPORT_CHANNELS -#ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; + float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; +#else + float *p_output[MAX_OUTPUT_CHANNELS]; + float *p_tc[MAX_TRANSPORT_CHANNELS]; #endif - ]; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; push_wmops( "ivas_dec_render" ); - /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ @@ -977,12 +952,11 @@ ivas_error ivas_jbm_dec_render( output_config = st_ivas->hDecoderConfig->output_config; nSamplesAskedLocal = nSamplesAsked + st_ivas->hTcBuffer->n_samples_discard; - for ( n = 0; n < MAX_OUTPUT_CHANNELS #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + for ( n = 0; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) +#else + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) #endif - ; - n++ ) { p_output[n] = &output[n][0]; } @@ -1133,9 +1107,7 @@ ivas_error ivas_jbm_dec_render( { nchan_remapped = st_ivas->nchan_transport; - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || - st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || - st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { @@ -1160,7 +1132,6 @@ ivas_error ivas_jbm_dec_render( nchan_remapped = nchan_transport; /* Loudspeakers, Ambisonics or Binaural rendering */ - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) @@ -1173,19 +1144,17 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_OSBA_STEREO ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + /* render objects */ ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); + /* add already rendererd SBA part */ for ( n = 0; n < nchan_out; n++ ) { v_add( p_output[n], p_tc[n + st_ivas->nchan_ism], p_output[n], *nSamplesRendered ); } } - else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS -#ifdef JBM_FOR_OSBA - || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM -#endif - ) + else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { float output_ism[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_output_ism[MAX_OUTPUT_CHANNELS]; @@ -1195,7 +1164,11 @@ ivas_error ivas_jbm_dec_render( p_output_ism[n] = &output_ism[n][0]; } - ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + #ifdef OSBA_ROOM_IR if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) #endif @@ -1216,8 +1189,11 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ { + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] ) ) != IVAS_ERR_OK ) + { + return error; + } - ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] ); for ( n = 0; n < st_ivas->nchan_ism; n++ ) { mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); @@ -1225,17 +1201,23 @@ ivas_error ivas_jbm_dec_render( } else { - ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } } } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || - st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); } else /* SBA_MODE_SPAR */ { - ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { #ifdef DEBUGGING @@ -1639,6 +1621,7 @@ ivas_error ivas_jbm_dec_flush_renderer( tc_local[ch_idx] = &st_ivas->hTcBuffer->tc[ch_idx + 2][hTcBuffer->n_samples_rendered]; mvr2r( st_ivas->hSbaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hSbaIsmData->delayBuffer_size ); } + /* transfer adapted sf info from hTcBuffer to SPAR and DirAC */ st_ivas->hSpar->nb_subframes = 1; st_ivas->hSpar->subframes_rendered = 0; @@ -1650,9 +1633,11 @@ ivas_error ivas_jbm_dec_flush_renderer( st_ivas->hSpatParamRendCom->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME; st_ivas->hSpatParamRendCom->slots_rendered = 0; st_ivas->hSpatParamRendCom->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME; + /* also adapt md maps, just use the last index */ set_s( st_ivas->hSpar->render_to_md_map, last_spar_md_idx, n_slots_still_available ); set_s( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available ); + /* render the last subframe */ if ( ( error = ivas_osba_dirac_td_binaural_jbm( st_ivas, (uint16_t) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) { @@ -1678,7 +1663,7 @@ ivas_error ivas_jbm_dec_flush_renderer( if ( st_ivas->hDecoderConfig->Opt_Limiter ) #endif { - if ( !( st_ivas->ivas_format == MONO_FORMAT ) ) + if ( st_ivas->ivas_format != MONO_FORMAT ) { #ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect ); @@ -1801,7 +1786,7 @@ void ivas_jbm_dec_get_adapted_subframes( uint16_t nCldfbSlotsLocal = nCldfbTs; /* get last subframe size from previous frame, determine how many slots have to be processed - in the first subframe (i.e. potential leftover of a 5ms subframe) */ + in the first subframe (i.e. potential leftover of a 5ms subframe) */ nSlotsInFirstSubframe = ( PARAM_MC_MAX_NSLOTS_IN_SUBFRAME - subframe_nbslots[*nb_subframes - 1] ); *nb_subframes = 0; if ( nSlotsInFirstSubframe > 0 ) @@ -1861,7 +1846,7 @@ void ivas_jbm_dec_get_md_map( } /* changed part (first segment), interpolate index to parameters - (we do not want to interpolate and smooth acutal direction/diffuseness values even more) */ + (we do not want to interpolate and smooth acutal direction/diffuseness values even more) */ if ( src_idx >= 0 ) { dec = ( (float) ( src_idx + 1 ) ) / ( (float) jbm_segment_len ); @@ -2241,12 +2226,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( if ( hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_NONE ) { hTcBuffer->tc_buffer = NULL; - for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) +#else + for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) #endif - ; - ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } @@ -2266,19 +2251,18 @@ ivas_error ivas_jbm_dec_tc_buffer_open( n_samp_residual = 0; } - nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; if ( nsamp_to_allocate == 0 ) { hTcBuffer->tc_buffer = NULL; - for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) +#else + for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) #endif - ; - ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } @@ -2302,12 +2286,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset += n_samp_residual; } - for ( ; ch_idx < MAX_TRANSPORT_CHANNELS #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) +#else + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) #endif - ; - ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } @@ -2420,13 +2403,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset += n_samp_residual; } - for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) +#else + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) #endif - - ; - ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } @@ -2489,15 +2471,15 @@ void ivas_jbm_dec_tc_buffer_close( if ( *phTcBuffer != NULL ) { - for ( i = 0; i < MAX_TRANSPORT_CHANNELS #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + for ( i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++ ) +#else + for ( i = 0; i < MAX_TRANSPORT_CHANNELS; i++ ) #endif - ; - i++ ) { ( *phTcBuffer )->tc[i] = NULL; } + if ( ( *phTcBuffer )->tc_buffer != NULL ) { free( ( *phTcBuffer )->tc_buffer ); @@ -2659,9 +2641,10 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( *--------------------------------------------------------------------------*/ void ivas_jbm_dec_copy_tc_no_tsm( - Decoder_Struct *st_ivas, - float *tc[], - const int16_t output_frame ) + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *tc[], /* i : transport channels */ + const int16_t output_frame /* i : output frame size */ +) { int16_t n_ch_full_copy; int16_t n_ch_cldfb; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b9fffea5802b6b150c1b3d3ea0d48932e6b7fef0..8009ac676a59d4b343bf9654d39aba4e120889fa 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -622,9 +622,7 @@ ivas_error ivas_masa_dec_open( st_ivas->hMasa = hMasa; /* allocate transport channels*/ - if ( - st_ivas->hDecoderConfig->Opt_5ms && - st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) + if ( st_ivas->hDecoderConfig->Opt_5ms && st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { int16_t nchan_to_allocate; TC_BUFFER_MODE buffer_mode; @@ -1505,11 +1503,11 @@ ivas_error ivas_masa_dec_reconfigure( { if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity ) { - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, #ifdef SPLIT_REND_WITH_HEAD_ROT - pcm_resolution, + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif - data ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index b1bcb298ef977f4176b4f509d6815bd386d305ec..2b23d7ec5ee6133eef225c9cfebd603ae5cbe5bc 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -2063,7 +2063,7 @@ static int16_t ivas_param_mc_bin2dec( /*------------------------------------------------------------------------- - * ivas_param_mc_uniform_encoder() + * ivas_param_mc_uniform_decoder() * * decode a uniformily coded sequence of float values *------------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index b4c8b39a08b98b73b8b403951f30c12172e47a8d..ba20432e2546fc026663a9f15924cccefaec4f63 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -661,6 +661,7 @@ ivas_error ivas_mc_paramupmix_dec_open( /* allocate transport channels*/ hMCParamUpmix->free_param_interpolator = 0; hMCParamUpmix->param_interpolator = NULL; + #ifdef NONBE_FIX_808_JBM_PARAMUPMIX_RS if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) { @@ -673,6 +674,7 @@ ivas_error ivas_mc_paramupmix_dec_open( ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } #endif + if ( st_ivas->hDecoderConfig->Opt_5ms == 1 && st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; @@ -688,6 +690,7 @@ ivas_error ivas_mc_paramupmix_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); } #endif + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO ) { buffer_mode = TC_BUFFER_MODE_BUFFER; @@ -698,6 +701,7 @@ ivas_error ivas_mc_paramupmix_dec_open( { nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { return error; @@ -1008,11 +1012,12 @@ static void ps_pred_process_sf( static void ivas_mc_paramupmix_dec_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , + float *output_f[MAX_OUTPUT_CHANNELS], /* i/o: synthesized core-coder transport channels */ const int16_t slot_index_start +#else + float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ #endif ) { @@ -1161,7 +1166,6 @@ static void ivas_mc_paramupmix_dec_sf( } #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL ) { for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) @@ -1175,7 +1179,6 @@ static void ivas_mc_paramupmix_dec_sf( st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config; } -#endif } #endif diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 8243c1971009709595dbacfa7e95fda4ab40ce20..909265ca56b91dfb85001b1a80cca5c41322db6c 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1323,7 +1323,7 @@ static ivas_error ivas_mc_dec_reconfig( } /*-----------------------------------------------------------------* - * Reconfigure TC buffer + * JBM TC buffers *-----------------------------------------------------------------*/ if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) @@ -1336,11 +1336,13 @@ static ivas_error ivas_mc_dec_reconfig( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; tc_nchan_full_new = tc_nchan_allocate_new; } + if ( st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO ) { tc_nchan_full_new = 0; diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 00566a59203f28ada44bb987f698e1103554fa94..0936209639d9388e7910919011740336be89bf28 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -76,6 +76,28 @@ ivas_error ivas_mono_dmx_renderer_open( } +/*------------------------------------------------------------------------- + * ivas_mono_dmx_renderer_close() + * + * Close decoder downmix handle + *-------------------------------------------------------------------------*/ + +void ivas_mono_dmx_renderer_close( + MONO_DOWNMIX_RENDERER_HANDLE *hMonoDmxRenderer /* i/ i/o: Mono downmix structure */ +) +{ + if ( hMonoDmxRenderer == NULL || *hMonoDmxRenderer == NULL ) + { + return; + } + + free( *hMonoDmxRenderer ); + *hMonoDmxRenderer = NULL; + + return; +} + + /*------------------------------------------------------------------------- * ivas_mono_downmix_render_passive() * diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index adb1597cfd6aa582d0519d7d46ad0e7064dcf5e8..1af9cff4b7f1415c94eb7d175619e7b45adf80f7 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -312,11 +312,7 @@ ivas_error ivas_omasa_dec_config( } else { - if ( st_ivas->hMonoDmxRenderer != NULL ) - { - free( st_ivas->hMonoDmxRenderer ); - st_ivas->hMonoDmxRenderer = NULL; - } + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); } } @@ -345,15 +341,8 @@ ivas_error ivas_omasa_dec_config( else { /* TD renderer handle */ - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - - if ( st_ivas->hHrtfTD != NULL ) // VE: this is copied from ivas_ism_bitrate_switching() but a review is needed - { - st_ivas->hHrtfTD = NULL; - } + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; /* ISM renderer handle + ISM data handle */ ivas_omasa_separate_object_renderer_close( st_ivas ); diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 7b5a44c64c4158506d5b4a2a8d4219f0ab537146..d389c137b3494ba570b7dbc55e99e256afc09a83 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -119,14 +119,14 @@ void ivas_osba_data_close( /*--------------------------------------------------------------------------* - * ivas_osba_dirac_td_binaural() + * ivas_osba_dirac_td_binaural_jbm() * - * Binaural rendering in OSBA format + * Binaural rendering in JBM OSBA format *--------------------------------------------------------------------------*/ #ifdef JBM_FOR_OSBA ivas_error ivas_osba_dirac_td_binaural_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ @@ -136,7 +136,10 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t n; ivas_error error; - ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[2] ); + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[2] ) ) != IVAS_ERR_OK ) + { + return error; + } if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK ) { @@ -156,6 +159,13 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( } #endif + +/*--------------------------------------------------------------------------* + * ivas_osba_dirac_td_binaural() + * + * Binaural rendering in OSBA format + *--------------------------------------------------------------------------*/ + ivas_error ivas_osba_dirac_td_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* o : output synthesis signal */ @@ -192,13 +202,11 @@ ivas_error ivas_osba_dirac_td_binaural( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { - if ( ( error = ivas_sba_upmixer_renderer( st_ivas, #ifdef JBM_FOR_OSBA - output, + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) #else - &output[channel_offset], + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output[channel_offset], output_frame ) ) != IVAS_ERR_OK ) #endif - output_frame ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 88d2f96adfcfe7ffcbf690377f1c60d0df81a1ad..657fa827c4590a8a18c127c15025f2c39287d766 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -89,11 +89,11 @@ void ivas_renderer_select( { if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL ) #endif - ) { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -142,11 +142,12 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && st_ivas->nchan_transport <= 2 ) ) { *internal_config = output_config; - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL + #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL ) #endif - ) { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -158,6 +159,7 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { *internal_config = IVAS_AUDIO_CONFIG_HOA3; + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM @@ -170,6 +172,7 @@ void ivas_renderer_select( { *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } + #ifdef OSBA_ROOM_IR if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { @@ -205,11 +208,11 @@ void ivas_renderer_select( { *internal_config = output_config; - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL ) #endif - ) { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } diff --git a/lib_dec/ivas_pca_dec.c b/lib_dec/ivas_pca_dec.c index 8dbbbded046491db1904bda01143ddc398e7ab9a..fc7c214b11a3e36a82b16203ac0e4b3d7dcee2fd 100644 --- a/lib_dec/ivas_pca_dec.c +++ b/lib_dec/ivas_pca_dec.c @@ -260,8 +260,9 @@ void ivas_pca_dec( return; } +#ifdef DEBUGGING assert( ivas_total_brate == PCA_BRATE ); /* the remaining code is defined at 256k where there are 4 dmx channel */ - +#endif if ( !bfi ) { /* set PCA by-pass mode indicator */ @@ -312,6 +313,5 @@ void ivas_pca_dec( pca_dec_update_dquat( hPCA, ql, qr ); hPCA->prev_pca_bypass = 0; - return; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a88e1b408a9b119fe803a58b0c12d637cdcc3039..de684f317662760546ba5dd2e66bdeb4200d7e0a 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -105,7 +105,7 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef JBM_FOR_OSBA , uint16_t *nSamplesFlushed, /* o : number of samples flushed */ -#if defined SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -136,10 +136,8 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef JBM_FOR_OSBA int16_t granularity_new; #endif - ism_mode_old = st_ivas->ism_mode; - - error = IVAS_ERR_OK; + ism_mode_old = st_ivas->ism_mode; hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; @@ -152,10 +150,11 @@ ivas_error ivas_sba_dec_reconfigure( * Set SBA high-level parameters * Save old SBA high-level parameters *-----------------------------------------------------------------*/ - nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, sba_analysis_order_old, last_ivas_total_brate ); + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, sba_analysis_order_old, last_ivas_total_brate ); ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nchan_hp20_old = getNumChanSynthesis( st_ivas ); + if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { if ( ivas_total_brate >= IVAS_256k ) @@ -181,7 +180,6 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef JBM_FOR_OSBA *nSamplesFlushed = 0; - granularity_new = st_ivas->hTcBuffer->n_samples_granularity; /* we may need to flush only for binaural and OSBA and TSM */ @@ -196,12 +194,11 @@ ivas_error ivas_sba_dec_reconfigure( /* copy the logic from ivas_renderer_select(), because calling this function has too many side effects that would affect the flushing */ if ( ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) <= 2 ) { - - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL ) #endif - ) { renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; } @@ -225,15 +222,17 @@ ivas_error ivas_sba_dec_reconfigure( renderer_type_new = RENDERER_BINAURAL_FASTCONV_ROOM; } } + /* determine new granularity */ granularity_new = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + /* this will change anyway only with binaural */ if ( renderer_type_new == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { granularity_new *= JBM_CLDFB_SLOTS_IN_SUBFRAME; } - /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ + /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { /* write back info for correct rendering of the flushable samples */ @@ -243,14 +242,16 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->sba_analysis_order = sba_analysis_order_old; #endif st_ivas->hDecoderConfig->ivas_total_brate = last_ivas_total_brate; - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, + #ifdef SPLIT_REND_WITH_HEAD_ROT - pcm_resolution, + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, pcm_resolution, data ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, data ) ) != IVAS_ERR_OK ) #endif - data ) ) != IVAS_ERR_OK ) { return error; } + /* restore correct values for the current frame*/ st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; @@ -270,7 +271,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( ism_mode_old != ISM_SBA_MODE_DISC ) #endif { - if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) // ToDo; this never happens + if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) { st_ivas->hTcBuffer->num_slots = st_ivas->hSpar->num_slots; st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpar->nb_subframes; @@ -287,9 +288,11 @@ ivas_error ivas_sba_dec_reconfigure( mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } + /*-----------------------------------------------------------------* * Allocate, initialize, and configure SBA handles *-----------------------------------------------------------------*/ + int16_t sba_order_internal; SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; @@ -306,7 +309,6 @@ ivas_error ivas_sba_dec_reconfigure( if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k ) || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k ) ) { - ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK ) @@ -314,12 +316,9 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } - else if ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) { - num_channels = st_ivas->hSpar->hMdDec->spar_md_cfg.num_umx_chs; - ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels ); num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); @@ -328,8 +327,8 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } - if ( ( hSpar->hPCA == NULL ) && - ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 ) && ( st_ivas->ivas_format == SBA_FORMAT ) ) + + if ( hSpar->hPCA == NULL && st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 && st_ivas->ivas_format == SBA_FORMAT ) { if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) { @@ -338,6 +337,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_pca_dec_init( hSpar->hPCA ); } + ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); } else @@ -359,7 +359,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hSpar->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); #endif - if ( st_ivas->nchan_transport == 1 ) { st_ivas->element_mode_init = IVAS_SCE; @@ -401,17 +400,17 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef JBM_FOR_OSBA - if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX && !st_ivas->hMonoDmxRenderer ) + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX && st_ivas->hMonoDmxRenderer == NULL ) { if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } } - if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->hMonoDmxRenderer != NULL ) + + if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) { - free( st_ivas->hMonoDmxRenderer ); - st_ivas->hMonoDmxRenderer = NULL; + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); } #endif @@ -491,6 +490,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { int32_t temp_brate[MAX_SCE]; + st_ivas->ism_mode = ISM_SBA_MODE_DISC; if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, temp_brate ) ) != IVAS_ERR_OK ) { @@ -525,11 +525,7 @@ ivas_error ivas_sba_dec_reconfigure( } else { - if ( st_ivas->hMonoDmxRenderer != NULL ) - { - free( st_ivas->hMonoDmxRenderer ); - st_ivas->hMonoDmxRenderer = NULL; - } + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); } if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) @@ -565,10 +561,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - if ( st_ivas->hHrtfTD != NULL ) - { - st_ivas->hHrtfTD = NULL; - } + st_ivas->hHrtfTD = NULL; } } nchan_transport_old += st_ivas->nchan_ism; @@ -628,14 +621,14 @@ ivas_error ivas_sba_dec_reconfigure( } /*-----------------------------------------------------------------* - * JBM TC buffer + * JBM TC buffers *-----------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->Opt_5ms == 1 + #ifdef JBM_FOR_OSBA - || st_ivas->ivas_format == SBA_ISM_FORMAT + if ( st_ivas->hDecoderConfig->Opt_5ms == 1 || st_ivas->ivas_format == SBA_ISM_FORMAT ) +#else + if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) #endif - - ) { int16_t tc_nchan_to_allocate; int16_t tc_nchan_tc; @@ -664,11 +657,12 @@ ivas_error ivas_sba_dec_reconfigure( { tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - else if ( st_ivas->ivas_format == SBA_FORMAT + #ifdef JBM_FOR_OSBA - || st_ivas->ivas_format == SBA_ISM_FORMAT + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) +#else + else if ( st_ivas->ivas_format == SBA_FORMAT ) #endif - ) { tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); #ifdef JBM_FOR_OSBA @@ -686,19 +680,17 @@ ivas_error ivas_sba_dec_reconfigure( } } - if ( tc_nchan_tc != st_ivas->hTcBuffer->nchan_transport_jbm || tc_nchan_to_allocate != st_ivas->hTcBuffer->nchan_transport_internal || tc_buffer_mode != st_ivas->hTcBuffer->tc_buffer_mode #ifdef JBM_FOR_OSBA - || granularity_new != st_ivas->hTcBuffer->n_samples_granularity + if ( tc_nchan_tc != st_ivas->hTcBuffer->nchan_transport_jbm || tc_nchan_to_allocate != st_ivas->hTcBuffer->nchan_transport_internal || tc_buffer_mode != st_ivas->hTcBuffer->tc_buffer_mode || granularity_new != st_ivas->hTcBuffer->n_samples_granularity ) +#else + if ( tc_nchan_tc != st_ivas->hTcBuffer->nchan_transport_jbm || tc_nchan_to_allocate != st_ivas->hTcBuffer->nchan_transport_internal || tc_buffer_mode != st_ivas->hTcBuffer->tc_buffer_mode ) #endif - ) { - if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode, tc_nchan_tc, tc_nchan_to_allocate, tc_nchan_to_allocate, #ifdef JBM_FOR_OSBA - granularity_new + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode, tc_nchan_tc, tc_nchan_to_allocate, tc_nchan_to_allocate, granularity_new ) ) != IVAS_ERR_OK ) #else - NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode, tc_nchan_tc, tc_nchan_to_allocate, tc_nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) #endif - ) ) != IVAS_ERR_OK ) { return error; } @@ -768,7 +760,7 @@ ivas_error ivas_sba_dec_reconfigure( #endif } - return error; + return IVAS_ERR_OK; } @@ -778,31 +770,28 @@ ivas_error ivas_sba_dec_reconfigure( * *-------------------------------------------------------------------*/ -ivas_error ivas_sba_dec_digest_tc( +void ivas_sba_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nCldfbSlots, /* i : number of CLDFB slots */ const int16_t nSamplesForRendering /* i : number of samples provided */ ) { int16_t ch_idx; - ivas_error error; #ifdef NONBE_FIX_826_JBM_MASA_CNA_CNG int16_t nchan_transport; #endif - error = IVAS_ERR_OK; - /* set the md map */ if ( st_ivas->hDirAC ) { ivas_dirac_dec_set_md_map( st_ivas, nCldfbSlots ); } - if ( st_ivas->ivas_format == SBA_FORMAT #ifdef JBM_FOR_OSBA - || st_ivas->ivas_format == SBA_ISM_FORMAT + if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) +#else + if ( st_ivas->ivas_format == SBA_FORMAT ) #endif - ) { ivas_spar_dec_digest_tc( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering ); } @@ -869,7 +858,7 @@ ivas_error ivas_sba_dec_digest_tc( generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna ); } - return error; + return; } @@ -893,6 +882,7 @@ ivas_error ivas_sba_dec_render( SPAR_DEC_HANDLE hSpar; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; + ivas_error error; hSpar = st_ivas->hSpar; hSpatParamRendCom = st_ivas->hSpatParamRendCom; @@ -937,7 +927,10 @@ ivas_error ivas_sba_dec_render( if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { - ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, 0, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup ); + if ( ( error = ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, 0, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) + { + return error; + } } if ( st_ivas->hDirAC != NULL && hSpar->slots_rendered == hSpar->num_slots ) diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index f33ef78d5367735a219f14ad261ca14b25fed8c3..8ed7de61f4a66e5136bb86169fe46b2e2f44c4e6 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -425,8 +425,6 @@ void ivas_ism2sba_sf( assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); assert( hIsmRendererData != NULL && "hIsmRendererData not allocated!" ); - - /* Init*/ sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); for ( j = 0; j < sba_num_chans; j++ ) @@ -471,7 +469,6 @@ ivas_error ivas_sba_upmixer_renderer( ivas_error error; push_wmops( "ivas_sba_upmixer_renderer" ); - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /* Upmixer + Renderer */ @@ -514,10 +511,10 @@ ivas_error ivas_sba_upmixer_renderer( *-------------------------------------------------------------------*/ ivas_error ivas_sba_linear_renderer( - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t nchan_in, /* i : number of input ambisonics channels */ - const int16_t nchan_ism, + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t nchan_in, /* i : number of input ambisonics channels */ + const int16_t nchan_ism, /* i : number of objects */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index f89e288ff4d60bb1b30004883c1d25f996c423e3..1d4687240507b3c60cf512211ce43f9829426f42 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -211,13 +211,11 @@ ivas_error ivas_spar_dec_open( } /* allocate transport channels*/ - if ( - ( st_ivas->hDecoderConfig->Opt_5ms #ifdef JBM_FOR_OSBA - || st_ivas->ivas_format == SBA_ISM_FORMAT + if ( ( st_ivas->hDecoderConfig->Opt_5ms || st_ivas->ivas_format == SBA_ISM_FORMAT ) && st_ivas->hTcBuffer == NULL ) +#else + if ( ( st_ivas->hDecoderConfig->Opt_5ms ) && st_ivas->hTcBuffer == NULL ) #endif - ) && - st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; int16_t nchan_tc; @@ -235,10 +233,7 @@ ivas_error ivas_spar_dec_open( { nchan_to_allocate += st_ivas->nchan_ism; } -#endif - -#ifdef JBM_FOR_OSBA granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); #endif @@ -279,18 +274,11 @@ ivas_error ivas_spar_dec_open( nchan_tc = 0; nchan_to_allocate = 0; } -#endif - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, - buffer_mode, - nchan_tc, - nchan_to_allocate, - nchan_to_allocate, -#ifdef JBM_FOR_OSBA - granularity + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) #else - NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) #endif - ) ) != IVAS_ERR_OK ) { return error; } @@ -1424,6 +1412,7 @@ void ivas_spar_dec_upmixer( nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + #ifdef JBM_FOR_OSBA nchan_internal_total = nchan_internal; sba_ch_offset = 0; @@ -1433,6 +1422,7 @@ void ivas_spar_dec_upmixer( sba_ch_offset = st_ivas->nchan_ism; } #endif + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { #ifdef JBM_FOR_OSBA @@ -1558,31 +1548,28 @@ void ivas_spar_dec_upmixer_sf( ) { int16_t cldfb_band, num_cldfb_bands, numch_in, numch_out; - float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS #ifdef OSBA_ROOM_IR - + MAX_NUM_OBJECTS -#endif - ][CLDFB_NO_COL_MAX]; - float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS -#ifdef OSBA_ROOM_IR - + MAX_NUM_OBJECTS + float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; + float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; +#else + float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX]; + float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX]; #endif - ][CLDFB_NO_COL_MAX]; int16_t i, b, ts, out_ch, in_ch; int16_t num_spar_bands, spar_band, nchan_transport; int16_t num_in_ingest, split_band; int16_t slot_size, slot_idx_start; - float *p_tc[MAX_OUTPUT_CHANNELS #ifdef OSBA_ROOM_IR - + MAX_NUM_OBJECTS + float *p_tc[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; +#else + float *p_tc[MAX_OUTPUT_CHANNELS]; #endif - ]; int16_t md_idx; - float Pcm_tmp[MAX_OUTPUT_CHANNELS #ifdef OSBA_ROOM_IR - + MAX_NUM_OBJECTS + float Pcm_tmp[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; +#else + float Pcm_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; #endif - ][L_FRAME48k]; int16_t numch_out_dirac; float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; int16_t b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; @@ -1602,6 +1589,7 @@ void ivas_spar_dec_upmixer_sf( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); slot_idx_start = hSpar->slots_rendered; + #ifdef JBM_FOR_OSBA if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { @@ -1701,12 +1689,11 @@ void ivas_spar_dec_upmixer_sf( if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA ) { /* at this point, output channels are used as intermediate procesing buffers */ - for ( in_ch = 0; in_ch < MAX_OUTPUT_CHANNELS #ifdef OSBA_ROOM_IR - + MAX_NUM_OBJECTS + for ( in_ch = 0; in_ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; in_ch++ ) +#else + for ( in_ch = 0; in_ch < MAX_OUTPUT_CHANNELS; in_ch++ ) #endif - ; - in_ch++ ) { for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { @@ -1749,14 +1736,10 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - cldfbAnalysis_ts( - &p_tc[in_ch][ts * num_cldfb_bands], - cldfb_in_ts_re[in_ch][ts], - cldfb_in_ts_im[in_ch][ts], - num_cldfb_bands, - st_ivas->cldfbAnaDec[in_ch] ); + cldfbAnalysis_ts( &p_tc[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch] ); } } + #ifdef OSBA_ROOM_IR if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { @@ -1765,12 +1748,7 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - cldfbAnalysis_ts( - &p_tc[in_ch][ts * num_cldfb_bands], - cldfb_in_ts_re[in_ch][ts], - cldfb_in_ts_im[in_ch][ts], - num_cldfb_bands, - st_ivas->cldfbAnaDec[in_ch] ); + cldfbAnalysis_ts( &p_tc[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch] ); } } } @@ -1899,12 +1877,11 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || - !( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB + if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif - ) ) + ) ) #ifdef OSBA_ROOM_IR && !( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) #endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index c30e6e2378e3184436b1213e4989b0822ef4d94c..c634c1c816514f1611b1019cf3f65b6fed9279ea 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -911,11 +911,11 @@ typedef struct ivas_masa_ism_data_structure typedef struct decoder_tc_buffer_structure { float *tc_buffer; /* the buffer itself */ - float *tc[MAX_TRANSPORT_CHANNELS #ifdef JBM_FOR_OSBA - + MAX_NUM_OBJECTS + float *tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc */ +#else + float *tc[MAX_TRANSPORT_CHANNELS]; /* pointers into the buffer to the beginning of each tc */ #endif - ]; /* pointers into the buffer to the beginning of each tc */ TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 374c3e41895c3cd62d9ffac63e7522b3ad0bd78b..87757c3e0092e649da7389bee87dde1e1a8330fd 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -233,7 +233,6 @@ ivas_error IVAS_DEC_Open( st_ivas->sba_planar = 0; st_ivas->sba_analysis_order = 0; - return IVAS_ERR_OK; } @@ -870,7 +869,6 @@ ivas_error IVAS_DEC_GetSamples( #ifdef DEBUGGING assert( *nOutSamples == nSamplesAsked ); #endif - hIvasDec->nSamplesAvailableNext = 0; hIvasDec->nSamplesRendered = *nOutSamples; nSamplesRendered = *nOutSamples; @@ -1281,8 +1279,6 @@ static ivas_error IVAS_DEC_RendererFeedTcSamples( { Decoder_Struct *st_ivas; - ivas_error error; - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -1291,9 +1287,9 @@ static ivas_error IVAS_DEC_RendererFeedTcSamples( st_ivas = hIvasDec->st_ivas; /* feed the TCs to the IVAS renderer */ - error = ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesForRendering, nSamplesResidual, pcmBuf ); + ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesForRendering, nSamplesResidual, pcmBuf ); - return error; + return IVAS_ERR_OK; } @@ -1345,7 +1341,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *nSamplesBuffered /* o : number of samples still buffered */ + int16_t *nSamplesBuffered /* o : number of samples still buffered */ ) { *nSamplesBuffered = 0; @@ -1577,7 +1573,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( ivas_error IVAS_DEC_GetMasaMetadata( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ - uint8_t getFromJbmBuffer /* i : get metadata from a JBM buffer */ + const uint8_t getFromJbmBuffer /* i : get metadata from a JBM buffer */ ) { if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -1608,13 +1604,14 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ - IVAS_VECTOR3 Pos, /* i : listener position */ - const int16_t subframe_idx /* i : subframe index */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ + IVAS_VECTOR3 Pos, /* i : listener position */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , - const IVAS_SPLIT_REND_ROT_AXIS rot_axis + const int16_t subframe_idx, /* i : subframe index */ + const IVAS_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */ +#else + const int16_t subframe_idx /* i : subframe index */ #endif ) { @@ -3500,7 +3497,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( #ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* - * IVAS_DEC_GetCldfbSamples() + * IVAS_DEC_GetSplitRendBits() * * *---------------------------------------------------------------------*/ @@ -3544,7 +3541,6 @@ ivas_error IVAS_DEC_GetCldfbSamples( ) { Decoder_Struct *st_ivas; - ivas_error error; int16_t ch, b, slot_idx, num_chs, maxBand, num_samples; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 181b8f665687cd66c71ec789de72f849a08675a4..4da8e13b3d82d8bd71401236ed9e8e897bf21622 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -203,20 +203,21 @@ ivas_error IVAS_DEC_GetObjectMetadata( /*! r: error code */ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ - uint8_t getFromJbmBuffer /* i : get metadata from a JBM buffer */ + const uint8_t getFromJbmBuffer /* i : get metadata from a JBM buffer */ ); /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ - IVAS_VECTOR3 Pos, /* i : listener position */ - const int16_t subframe_idx /* i : subframe index */ + IVAS_VECTOR3 Pos, /* i : listener position */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const int16_t subframe_idx, /* i : subframe index */ IVAS_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */ +#else + const int16_t subframe_idx /* i : subframe index */ #endif ); @@ -225,6 +226,7 @@ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ); + /*! r: error code */ ivas_error IVAS_DEC_FeedRefVectorData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 0d5c64b5d9b52b8077197ed5acbeb989e320e2c7..c0ccb648c0a4fa32522e835d94a91de1f7ef00e5 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -117,10 +117,10 @@ static void DecodeSWBSubbands( const int16_t *subband_search_offset, int16_t *prev_frm_hfe2, int16_t *prev_stab_hfe2, - int16_t band_width[], /* i : subband band widths */ - const int16_t *subband_offsets, /* i : subband offsets for sparse filling */ - const float spectra_ni[], /* i : core coder with sparseness filled */ - int16_t *ni_seed /* i/o: random seed for search buffer NI */ + int16_t band_width[], /* i : subband band widths */ + const int16_t *subband_offsets, /* i : subband offsets for sparse filling */ + const float spectra_ni[], /* i : core coder with sparseness filled */ + int16_t *ni_seed /* i/o: random seed for search buffer NI */ ) { int16_t i; diff --git a/lib_enc/core_switching_enc.c b/lib_enc/core_switching_enc.c index 2b16b49d46d5a5e7a2d69b9d34ed460ba19516e3..e964f33c089dbbecaccc55b103afb6b244d4e537 100644 --- a/lib_enc/core_switching_enc.c +++ b/lib_enc/core_switching_enc.c @@ -258,7 +258,7 @@ void core_switching_pre_enc( /* reset BWE memories */ if ( st->hBWE_TD != NULL ) { - set_f( st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); /* TODO - TBV: this might not be needed */ + set_f( st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); } } diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 071ae25c892039f0c24b12b0b0ace27eceaff402..b813a2730d27e98a7a7ce18af5cfa917880845c2 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -60,9 +60,8 @@ ivas_error init_encoder( const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ - const ISM_MODE ism_mode /* i : ISM mode */ - , - const int32_t element_brate /* i : element bitrate */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const int32_t element_brate /* i : element bitrate */ ) { int16_t i; diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index 03cb2aa2edef36792b2d7c0a36d8e99eb2c125fc..09db68d7d6d03f5cd7fd215ccfebd53066d57ec6 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -49,16 +49,16 @@ #define AGC_MIN_DELTA ( 4.656612873077393e-10f ) /*2^-31*/ - +#ifdef DEBUG_AGC /*------------------------------------------------------------------------------------------* * Local functions declarations *------------------------------------------------------------------------------------------*/ -#ifdef DEBUG_AGC + extern FILE *agcOut; static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_agc_enc_state_t *pState ); -#endif +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_agc_enc_get_flag() @@ -69,9 +69,9 @@ static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_ /*! r: AGC enable flag */ int16_t ivas_agc_enc_get_flag( #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - int16_t agc_configuration, /* i : AGC configuration from command-line */ + const int16_t agc_configuration, /* i : AGC configuration from command-line */ #endif - int16_t nchan_transport /* i : number of transport channels */ + const int16_t nchan_transport /* i : number of transport channels */ ) { int16_t agc_flag; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index b5d9d3cc6ba2f1ef8756560888e125ad27fb21a0..1eadfc77b43fd5beaf2a609f1e75f2471b280b4f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -111,7 +111,7 @@ ivas_error ivas_cpe_enc( int32_t cpe_brate; int32_t element_brate_ref; #ifdef NONBE_FIX_838_CRASH_24_4_WB - int16_t last_bits_frame_nominal; + int16_t last_bits_frame_nominal; /* last_bits_frame_nominal for M or PCh channel */ #endif error = IVAS_ERR_OK; diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 481d7e23bd831f8a8f78947defade19d108d16f7..2cf50b22724e468b1924194d20aeb00408948f13 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -212,11 +212,8 @@ ivas_error ivas_enc( } else if ( ivas_format == SBA_FORMAT || ivas_format == MASA_FORMAT ) { - /* SBA/MASA configuration */ - if ( ivas_format == SBA_FORMAT ) - { - } - else + /* MASA configuration */ + if ( ivas_format == MASA_FORMAT ) { ivas_masa_enc_reconfigure( st_ivas ); } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index a042e284fa45899551cf965113952e9b5d6cd68a..e1aa7113af96c8a2d7062645bc5c5ed829a07c42 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -1246,7 +1246,7 @@ ivas_error ivas_initialize_MD_bstr_enc( /*------------------------------------------------------------------------- * ivas_destroy_MD_bstr_enc() * - * Destroy SCE/CPE MD bistream handle + * Destroy SCE/CPE MD bitstream handle *-------------------------------------------------------------------------*/ void ivas_destroy_MD_bstr_enc( diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index e1a869d28e3dc3920896f78e8ffd28cfe5b68756..849b7957ae86da6e1152d7fa864db63aac05e6a7 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -204,7 +204,6 @@ ivas_error ivas_ism_metadata_enc( ivas_error error; error = IVAS_ERR_OK; - push_wmops( "ism_meta_enc" ); /* initialization */ @@ -291,6 +290,7 @@ ivas_error ivas_ism_metadata_enc( /*----------------------------------------------------------------* * Rate importance of particular ISM streams *----------------------------------------------------------------*/ + if ( ism_mode != ISM_SBA_MODE_DISC ) { rate_ism_importance( nchan_transport, hIsmMeta, hSCE, lowrate_metadata_flag, ism_imp ); @@ -974,6 +974,7 @@ static void encode_radius( * * Encoding of an angle *----------------------------------------------------------------*/ + static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 96d0a30feae704870cd1063d6b555028fe74ca40..788796d4a0de4d695abb3e171f104e6afa69cb22 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -376,9 +376,8 @@ void ivas_osba_enc( const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ const ISM_MODE ism_mode, /* i : ISM mode */ const int16_t sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ - const int32_t input_Fs /* i : input sampling rate */ - , - const int16_t sba_planar /* i : planar SBA flag */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t sba_planar /* i : planar SBA flag */ ) { float data_out_f[MAX_INPUT_CHANNELS][L_FRAME48k]; diff --git a/lib_enc/ivas_pca_enc.c b/lib_enc/ivas_pca_enc.c index 8ecac8d208381ae0f6c36ea2c6f480596135a7cc..f8b4c8e9a6fe7c2e6df9808e25031ae2faef2ff5 100644 --- a/lib_enc/ivas_pca_enc.c +++ b/lib_enc/ivas_pca_enc.c @@ -139,19 +139,17 @@ static void pca_enc_transform( quat_shortestpath( hPCA->prev_ql, ql, hPCA->prev_qr, qr ); - pca_interp_preproc( hPCA->prev_ql, hPCA->prev_qr, ql, qr, IVAS_PCA_N_SLOTS, ql_interp, qr_interp ); slot_len = (int16_t) ( input_frame / IVAS_PCA_N_SLOTS ); + for ( time_slot = 0; time_slot < IVAS_PCA_N_SLOTS; time_slot++ ) { /* convert from double quaternion to 4D matrix */ - dquat2mat( &ql_interp[IVAS_PCA_INTERP * time_slot], &qr_interp[IVAS_PCA_INTERP * time_slot], - eigVec_interp ); + dquat2mat( &ql_interp[IVAS_PCA_INTERP * time_slot], &qr_interp[IVAS_PCA_INTERP * time_slot], eigVec_interp ); pca_transform_sub( eigVec_interp, transformed_data, slot_len * time_slot, slot_len, n_channels ); } - return; } @@ -307,7 +305,6 @@ void ivas_pca_enc( return; } - /* handle bitrate switching */ if ( ivas_total_brate != PCA_BRATE ) { @@ -319,6 +316,7 @@ void ivas_pca_enc( /* copy input data into output directly as previous frame was already in by-pass mode */ for ( k = 0; k < n_channels; k++ ) { + // ToDo: TBV } } else @@ -334,8 +332,9 @@ void ivas_pca_enc( return; } +#ifdef DEBUGGING assert( ivas_total_brate == PCA_BRATE ); /* the remaining code is defined at 256k where there are 4 dmx channel */ - +#endif /*-----------------------------------------------------------------* * Covariance *-----------------------------------------------------------------*/ @@ -510,14 +509,22 @@ void ivas_pca_enc( dotl = dotp( hPCA->prev_ql, ql, 4 ); dotr = dotp( hPCA->prev_qr, qr, 4 ); if ( dotl < dotr ) + { min_dot = dotl; + } else + { min_dot = dotr; + } if ( ql[0] < qr[0] ) + { min_dot2 = ql[0]; + } else + { min_dot2 = qr[0]; + } bypass_decision = PCA_MODE_ACTIVE; if ( dist_alt < IVAS_PCA_THRES_DIST_ALT ) @@ -556,6 +563,7 @@ void ivas_pca_enc( pca_update_state( hPCA, ql, qr, eigVec, n_channels ); hPCA->prev_bypass_decision = PCA_MODE_INACTIVE; + return; } @@ -589,6 +597,5 @@ void ivas_pca_enc( hPCA->prev_bypass_decision = bypass_decision; pca_update_state( hPCA, ql, qr, eigVec, n_channels ); - return; } diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 32068339303d556e253b6f370e3844651de3d027..1b62335b9b930d29cced3e44a68a3f0fa7e656b3 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -211,6 +211,7 @@ ivas_error ivas_sba_enc_reconfigure( { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } + if ( nchan_transport_old != st_ivas->nchan_transport || ( ivas_total_brate < IVAS_512k && hEncoderConfig->last_ivas_total_brate >= IVAS_512k ) || ( ivas_total_brate >= IVAS_512k && hEncoderConfig->last_ivas_total_brate < IVAS_512k ) ) { /* FB mixer handle */ @@ -227,11 +228,14 @@ ivas_error ivas_sba_enc_reconfigure( return error; } } + st_ivas->hSpar->spar_reconfig_flag = spar_reconfig_flag; + if ( ( error = ivas_dirac_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { return error; } + if ( st_ivas->hQMetaData->q_direction->cfg.nbands != nbands_old || st_ivas->hQMetaData->no_directions != ndir_old ) { int16_t dir, j, i; diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 3e8666e24d58ef5eb38ce6d0ab25e1d03306d649..5a6ef2289b6319a14874b8cb43e9d223674bf2e8 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -254,16 +254,14 @@ ivas_error ivas_spar_md_enc_init( hMdEnc->spar_md.prior_dyn_active_w_flag = 0; - ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, - hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, #ifndef DEBUG_AGC_ENCODER_CMD_OPTION - ivas_agc_enc_get_flag( ivas_spar_br_table_consts[table_idx].nchan_transport ) + ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, + hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, ivas_agc_enc_get_flag( ivas_spar_br_table_consts[table_idx].nchan_transport ) ); #else - ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, ivas_spar_br_table_consts[table_idx].nchan_transport ) + ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, + hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, ivas_spar_br_table_consts[table_idx].nchan_transport ) ); #endif - ); - /* get FB coefficients */ for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) { diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index a69bb1bf356f59be088d386fb5c4b73b5ad636b1..13399ba0ca21377e48734c52990e72f60ac018d7 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -52,7 +52,7 @@ typedef enum _IVAS_ENC_INPUT_FORMAT IVAS_ENC_INPUT_MC, IVAS_ENC_INPUT_MASA_ISM, IVAS_ENC_INPUT_SBA_ISM, - IVAS_DEC_INPUT_UNKNOWN = 0xffff + IVAS_ENC_INPUT_UNKNOWN = 0xffff } IVAS_ENC_INPUT_FORMAT; typedef enum _IVAS_ENC_BANDWIDTH @@ -86,7 +86,7 @@ typedef enum _IVAS_ENC_MC_LAYOUT IVAS_ENC_MC_5_1_2 = 14, IVAS_ENC_MC_5_1_4 = 16, IVAS_ENC_MC_7_1_4 = 19, - IVAS_ENC_CICP_UNDEFINED = 0xffff + IVAS_ENC_MC_UNDEFINED = 0xffff } IVAS_ENC_MC_LAYOUT; typedef enum _IVAS_ENC_MASA_VARIANT @@ -158,7 +158,7 @@ typedef struct IVAS_ENC *IVAS_ENC_HANDLE; /*! r: error code */ ivas_error IVAS_ENC_Open( - IVAS_ENC_HANDLE *phIvasEnc /* i/o: pointer to an encoder handle to be opened */ + IVAS_ENC_HANDLE *phIvasEnc /* i/o: pointer to an encoder handle to be opened */ ); /*! r: error code */ @@ -169,7 +169,7 @@ ivas_error IVAS_ENC_ConfigureForMono( const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig, /* i : configuration of channel-aware mode, can by set to default by using IVAS_ENC_GetDefaultChannelAwareConfig() */ + const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig, /* i : configuration of channel-aware mode, can by set to default by using IVAS_ENC_GetDefaultChannelAwareConfig() */ const bool downmixFromStereo, /* i : if true, the encoder accepts a stereo input and internally downmixes it to mono before encoding */ const bool is_binaural /* i : if true, the input is binaural audio */ ); @@ -185,7 +185,7 @@ ivas_error IVAS_ENC_ConfigureForStereo( const bool is_binaural /* i : flag indicating if input is binaural audio */ #ifdef DEBUGGING , - const IVAS_ENC_STEREO_MODE stereoMode /* i : forces a specific stereo coding mode */ + const IVAS_ENC_STEREO_MODE stereoMode /* i : forces a specific stereo coding mode */ #endif ); @@ -203,26 +203,26 @@ ivas_error IVAS_ENC_ConfigureForObjects( /*! r: encoder error code */ ivas_error IVAS_ENC_ConfigureForMASAObjects( - IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the ouput bitstream */ - const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ - const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ - const int16_t masaVariant /* i : index specifying the number of MASA transport channels */ + IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + const int32_t inputFs, /* i : input sampling frequency */ + const int32_t bitrate, /* i : requested bitrate of the ouput bitstream */ + const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ + const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ + const uint16_t numObjects, /* i : number of objects to be encoded */ + const int16_t masaVariant /* i : index specifying the number of MASA transport channels */ ); /*! r: encoder error code */ ivas_error IVAS_ENC_ConfigureForSBAObjects( - IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the ouput bitstream */ - const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ - const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ - const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ - const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ - const bool Opt_PCA_ON /* i : PCA option flag */ + IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + const int32_t inputFs, /* i : input sampling frequency */ + const int32_t bitrate, /* i : requested bitrate of the ouput bitstream */ + const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ + const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ + const uint16_t numObjects, /* i : number of objects to be encoded */ + const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ + const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ + const bool Opt_PCA_ON /* i : PCA option flag */ ); /*! r: error code */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 6741c8a88a0eecc8eb6bf5f7672d7c4bdd711237..0563921c6bcc20526ddedf8dbbc39424f800e9a4 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1125,10 +1125,11 @@ static ivas_error ivas_er_init_handle( *------------------------------------------------------------------------*/ ivas_error ivas_rend_initCrendWrapper( - CREND_WRAPPER_HANDLE *pCrend #ifdef SPLIT_REND_WITH_HEAD_ROT - , + CREND_WRAPPER_HANDLE *pCrend, const int16_t num_poses +#else + CREND_WRAPPER_HANDLE *pCrend #endif ) { @@ -1238,10 +1239,11 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, HRTFS_CREND_HANDLE hSetOfHRTF, - const int32_t output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const int32_t output_Fs, const int16_t num_poses +#else + const int32_t output_Fs #endif ) { @@ -1418,10 +1420,11 @@ ivas_error ivas_rend_openCrend( *------------------------------------------------------------------------*/ void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend #ifdef SPLIT_REND_WITH_HEAD_ROT - , + CREND_WRAPPER_HANDLE *pCrend, const int16_t num_poses +#else + CREND_WRAPPER_HANDLE *pCrend #endif ) { @@ -1574,10 +1577,11 @@ static ivas_error ivas_rend_crendConvolver( float *pcm_in[], float *pcm_out[], const int32_t output_Fs, - const int16_t i_ts #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const int16_t i_ts, const int16_t pos_idx +#else + const int16_t i_ts #endif ) { @@ -1751,10 +1755,11 @@ ivas_error ivas_rend_crendProcess( EFAP_HANDLE hEFAPdata, float *output[], /* i/o: input/output audio channels */ const int32_t output_Fs, - const int16_t num_subframes /* i : number of subframes to render */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const int16_t num_subframes /* i : number of subframes to render */, const int16_t pos_idx +#else + const int16_t num_subframes /* i : number of subframes to render */ #endif ) { @@ -1787,7 +1792,6 @@ ivas_error ivas_rend_crendProcess( } push_wmops( "ivas_rend_crendProcess" ); - inConfigType = getAudioConfigType( inConfig ); if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) @@ -1871,7 +1875,6 @@ ivas_error ivas_rend_crendProcess( } pop_wmops(); - return IVAS_ERR_OK; } @@ -1923,7 +1926,6 @@ ivas_error ivas_rend_crendProcessSubframe( } push_wmops( "ivas_rend_crendProcessSubframe" ); - inConfigType = getAudioConfigType( inConfig ); if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) @@ -2151,17 +2153,7 @@ ivas_error ivas_rend_crendProcessSplitBin( { mvr2r( hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 ); } - if ( ( error = ivas_rend_crendProcess( pCrend, - inConfig, - outConfig, - hDecoderConfig, - pCombinedOrientationDataLocal, - hIntSetup, - hEFAPdata, - p_tmpInputBuffer, - output_Fs, - hCombinedOrientationData->num_subframes, - pos_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( pCrend, inConfig, outConfig, hDecoderConfig, pCombinedOrientationDataLocal, hIntSetup, hEFAPdata, p_tmpInputBuffer, output_Fs, hCombinedOrientationData->num_subframes, pos_idx ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 795f2aeea711f8043083de6f13255e4c74ab1476..8e54ca81486995060d2f8a800a6eb8328f3b6e47 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -311,9 +311,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( #endif /* allocate transport channels*/ - if ( - st_ivas->hDecoderConfig->Opt_5ms && - st_ivas->hTcBuffer == NULL ) + if ( st_ivas->hDecoderConfig->Opt_5ms && st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; int16_t n_samples_granularity; @@ -353,6 +351,7 @@ void ivas_dirac_dec_close_binaural_data( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN int16_t pos_idx; #endif + if ( hBinaural == NULL || *hBinaural == NULL ) { return; @@ -672,7 +671,6 @@ static void ivas_dirac_dec_binaural_internal( DIFFUSE_DISTRIBUTION_DATA diffuseDistData; int16_t nBins, offsetSamples; int16_t i, j; - #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN int16_t pos_idx; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index b29b5a312e05b45792b0a041de29bc90982fe525..f10b7b2c225c57450d098ab0e094321ceaa6694b 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1055,8 +1055,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( p_gains_dir++; p_gains_dir_prev++; - output_real[l * num_channels_dir + ch_idx] = 0.5f * gs1 * ( 1.772454e+00f * ( *p_proto ) + 1.023327e+00f * ( *p_proto2 ) ) + // s1 - 0.5f * gs2 * ( 1.772454e+00f * ( *p_proto ) - 1.023327e+00f * ( *p_proto2 ) ); // s2 + output_real[l * num_channels_dir + ch_idx] = 0.5f * gs1 * ( 1.772454e+00f * ( *p_proto ) + 1.023327e+00f * ( *p_proto2 ) ) + /* s1 */ + 0.5f * gs2 * ( 1.772454e+00f * ( *p_proto ) - 1.023327e+00f * ( *p_proto2 ) ); /* s2 */ p_proto++; p_proto2++; output_imag[l * num_channels_dir + ch_idx] = 0.5f * gs1 * ( 1.772454e+00f * ( *p_proto ) + 1.023327e+00f * ( *p_proto2 ) ) + diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 9b3b55e20d6a00f7a32621b662246e1c981c62f1..5799049e2044341b14a0d4d4ec0aa785a8ebbd7c 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -264,10 +264,9 @@ void ivas_output_init( /*! r: number of decoder buffers */ int16_t ivas_get_nchan_buffers_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , - const int16_t sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ - const int32_t ivas_total_brate /* i : total IVAS bitrate */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t sba_analysis_order, /* i : SBA order evaluated in SBA decoder */ + const int32_t ivas_total_brate /* i : total IVAS bitrate */ ) { int16_t nchan_out_buff; @@ -377,6 +376,7 @@ int16_t ivas_get_nchan_buffers_dec( { nchan_out_buff = st_ivas->hDecoderConfig->nchan_out + st_ivas->nchan_ism; /*take into account sba_ch_idx' in ivas_dec() */ } + #ifdef JBM_FOR_OSBA if ( !( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) #endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 4f456f4cf110ddf0158a76abd3d0ecb35ced83e0..e84761e6f0eecb3679fd7cbe2b19f0e9899e0d35 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -72,10 +72,9 @@ void ivas_output_init( /*! r: number of decoder buffers */ int16_t ivas_get_nchan_buffers_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , - const int16_t sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ - const int32_t ivas_total_brate /* i : total IVAS bitrate */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t sba_analysis_order, /* i : SBA order evaluated in SBA decoder */ + const int32_t ivas_total_brate /* i : total IVAS bitrate */ ); @@ -818,30 +817,33 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, HRTFS_CREND_HANDLE hSetOfHRTF, - const int32_t output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const int32_t output_Fs, const int16_t num_poses +#else + const int32_t output_Fs #endif ); -void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend +void ivas_rend_closeCrend( #ifdef SPLIT_REND_WITH_HEAD_ROT - , + CREND_WRAPPER_HANDLE *pCrend , const int16_t num_poses +#else + CREND_WRAPPER_HANDLE *pCrend #endif ); ivas_error ivas_hrtf_init( - HRTFS_DATA *hHrtf /* i/o: HRTF handle */ + HRTFS_DATA *hHrtf /* i/o: HRTF handle */ ); ivas_error ivas_rend_initCrendWrapper( - CREND_WRAPPER_HANDLE *pCrend #ifdef SPLIT_REND_WITH_HEAD_ROT - , + CREND_WRAPPER_HANDLE *pCrend, const int16_t num_poses +#else + CREND_WRAPPER_HANDLE *pCrend #endif ); @@ -854,11 +856,12 @@ ivas_error ivas_rend_crendProcess( IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, float *output[], /* i/o: input/output audio channels */ - const int32_t output_Fs, - const int16_t num_subframes /* i : number of subframes to render */ + const int32_t output_Fs, #ifdef SPLIT_REND_WITH_HEAD_ROT - , - const int16_t pos_idx + const int16_t num_subframes, /* i : number of subframes to render */ + const int16_t pos_idx /* i : pose index */ +#else + const int16_t num_subframes /* i : number of subframes to render */ #endif ); @@ -1464,10 +1467,11 @@ void ivas_splitBinLCLDDecProcess( ivas_error ivas_splitBinPreRendOpen( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - , - const int32_t output_Fs + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int32_t output_Fs +#else + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #endif ); @@ -1538,10 +1542,12 @@ void ivas_splitBinPostRendClose( void ivas_splitBinPostRendMdDec( ivas_split_rend_bits_t *pBits, - BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - ,BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend +#else + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #endif ); @@ -1549,7 +1555,8 @@ ivas_error ivas_splitBinRendPLCOpen( SPLIT_REND_PLC_HANDLE* phSplitRendPLC ); -void ivas_splitBinRendPLCClose(SPLIT_REND_PLC_HANDLE* phSplitRendPLC +void ivas_splitBinRendPLCClose( + SPLIT_REND_PLC_HANDLE* phSplitRendPLC ); void ivas_splitBinRendPLCsaveState( diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 6489460a1cafcfb0b98c0552d71861afb630aeb9..1f43d39913a256c340f9dc6ce177c1b6e0929730 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1911,6 +1911,7 @@ ivas_error ivas_binaural_reverb_open( #ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, revTimes, revEnes ); + ivas_binaural_reverb_setPreDelay( hReverb, preDelay ); #else if ( ( roomAcoustics ) && ( roomAcoustics->override ) ) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7e2ba93b9c93c29e805a64f357a7096aea4d8a81..b6420deed1f928a94ba2d62a7064a9b9e1b054fc 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -52,7 +52,7 @@ static ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, IVAS_VECTOR3 *listenerPos, #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/ + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/ #endif EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9733874d3005716f45fa4a83970663c40f24415b..b585d3f6ba2dcab5a195a650455c659e8ad92676 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -668,6 +668,7 @@ typedef struct ivas_external_orientation_struct int16_t numFramesToTargetOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Number of frames until target orientation is reached */ IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; /* External orientation in quaternions */ int16_t num_subframes; + } EXTERNAL_ORIENTATION_DATA, *EXTERNAL_ORIENTATION_HANDLE; /*----------------------------------------------------------------------------------* @@ -706,6 +707,7 @@ typedef struct ivas_combined_orientation_struct int8_t isExtOrientationFrozen; int8_t isHeadRotationFrozen; int16_t num_subframes; + } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; @@ -829,8 +831,8 @@ typedef struct float soundspeed; float air_coeff; shoebox_config_t cal; -} shoebox_obj_t; +} shoebox_obj_t; typedef struct shoebox_data_t { @@ -839,7 +841,6 @@ typedef struct shoebox_data_t } shoebox_data_t; - typedef struct { uint16_t n_sources; @@ -851,6 +852,7 @@ typedef struct } shoebox_output_t; + /*----------------------------------------------------------------------------------* * Reflections structure *----------------------------------------------------------------------------------*/ @@ -1072,8 +1074,8 @@ typedef struct TDREND_SRC_REND_s float SrcGainMax_p[SPAT_BIN_MAX_INPUT_CHANNELS]; float DirGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; float DistGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; -} TDREND_SRC_REND_t; +} TDREND_SRC_REND_t; /* Source spatial parameters */ typedef struct @@ -1106,6 +1108,7 @@ typedef struct float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; float Gain; float prevGain; + } TDREND_SRC_t; /* Top level TD binaural renderer handle */ @@ -1224,7 +1227,7 @@ typedef struct ivas_binaural_rendering_struct #endif /*------------------------------------------------------------------------------------------* - * HRTF structures - htrfs from binary files + * HRTF structures - hrtfs from binary files *------------------------------------------------------------------------------------------*/ typedef struct ivas_hrtfs_crend_structure @@ -1237,9 +1240,7 @@ typedef struct ivas_hrtfs_crend_structure } HRTFS_CREND, *HRTFS_CREND_HANDLE; - /* Fastconv binaural data structure */ - typedef struct ivas_hrtfs_fastconv_struct { float FASTCONV_HOA3_latency_s; @@ -1279,7 +1280,6 @@ typedef struct ivas_hrtfs_fastconv_struct } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; - typedef struct ivas_hrtfs_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -1523,7 +1523,6 @@ typedef struct ivas_LS_setupconversion_struct } LSSETUP_CONVERSION_STRUCT, *LSSETUP_CONVERSION_HANDLE; - typedef struct ivas_LS_setupconversion_matrix { int16_t index; @@ -1573,6 +1572,7 @@ typedef struct int32_t binaural_latency_ns; BINAURAL_RENDERER_HANDLE hCldfbRend; HRTFS_FASTCONV_HANDLE hHrtfFastConv; + } CLDFB_REND_WRAPPER; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e11bb0812d8a7d3b1ee725819ca6cdb07d9f5544..96e57509933b2ca7cfd1e69600b826364c5e10dd 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -197,7 +197,6 @@ typedef struct #else rotation_gains rot_gains_prev; #endif - float *bufferData; DIRAC_ANA_HANDLE hDirAC; } input_sba; @@ -433,7 +432,7 @@ static void accumulateCLDFBArrayToBuffer( return; } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ +#endif static void copyBufferTo2dArray( const IVAS_REND_AudioBuffer buffer, @@ -1438,6 +1437,7 @@ static ivas_error setRendInputActiveIsm( { return error; } + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -1460,11 +1460,7 @@ static ivas_error setRendInputActiveIsm( } else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1688,9 +1684,7 @@ static ivas_error getRendInputNumChannels( int16_t *numInChannels ) { /* Using a void pointer for this function to be reusable for any input type (input_ism, input_mc, input_sba). - Assumptions: - - input_base is always the first member in the input struct - */ + Assumptions: - input_base is always the first member in the input struct */ ivas_error error; const input_base *pInputBase; @@ -1901,19 +1895,13 @@ static ivas_error updateLfePanGainsForMcOut( for ( i = 0; i < numLfeIn; i++ ) { /* panning gains */ - if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, - inputMc->lfeRouting.lfeOutputAzimuth, - inputMc->lfeRouting.lfeOutputElevation, - inputMc->lfeRouting.lfePanMtx[i] ) ) != IVAS_ERR_OK ) + if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth, inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i] ) ) != IVAS_ERR_OK ) { return error; } /* linear input gain */ - v_multc( inputMc->lfeRouting.lfePanMtx[i], - inputMc->lfeRouting.lfeInputGain, - inputMc->lfeRouting.lfePanMtx[i], - numOutChannels ); + v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], numOutChannels ); } return error; @@ -1945,16 +1933,10 @@ static ivas_error updateLfePanGainsForAmbiOut( for ( i = 0; i < numLfeIn; i++ ) { /* panning gains */ - ivas_dirac_dec_get_response( (int16_t) inputMc->lfeRouting.lfeOutputAzimuth, - (int16_t) inputMc->lfeRouting.lfeOutputElevation, - inputMc->lfeRouting.lfePanMtx[i], - outAmbiOrder ); + ivas_dirac_dec_get_response( (int16_t) inputMc->lfeRouting.lfeOutputAzimuth, (int16_t) inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i], outAmbiOrder ); /* linear input gain */ - v_multc( inputMc->lfeRouting.lfePanMtx[i], - inputMc->lfeRouting.lfeInputGain, - inputMc->lfeRouting.lfePanMtx[i], - IVAS_MAX_OUTPUT_CHANNELS ); + v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); } return error; @@ -2216,12 +2198,11 @@ static ivas_error initMcBinauralRendering( /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { - ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT - , - inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses + ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#else + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif - ); } if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) @@ -2965,12 +2946,10 @@ static ivas_error initMasaDummyDecForMcOut( int16_t numCldfbSyntheses; int16_t i; DecoderDummy *decDummy; - decDummy = inputMasa->decDummy; + decDummy = inputMasa->decDummy; decDummy->hDecoderConfig->output_config = outConfig; - decDummy->sba_analysis_order = 1; - decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ @@ -3049,16 +3028,14 @@ static ivas_error initMasaDummyDecForSbaOut( DecoderDummy *decDummy; decDummy = inputMasa->decDummy; - decDummy->hDecoderConfig->output_config = outConfig; - decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ - decDummy->sba_analysis_order = 1; ivas_output_init( &( decDummy->hOutSetup ), outConfig ); ivas_output_init( &( decDummy->hIntSetup ), outConfig ); + decDummy->renderer_type = RENDERER_DIRAC; decDummy->ivas_format = MASA_FORMAT; decDummy->transport_config = IVAS_AUDIO_CONFIG_INVALID; @@ -3118,16 +3095,16 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy = inputMasa->decDummy; decDummy->hDecoderConfig->output_config = outConfig; decDummy->sba_analysis_order = 1; - decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), outConfig ); - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL + #ifdef SPLIT_REND_WITH_HEAD_ROT - || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL ) #endif - ) { decDummy->renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -3204,10 +3181,11 @@ static DecoderDummy *initDecoderDummy( const int32_t sampleRate, const int16_t numTransChannels, const AUDIO_CONFIG outConfig, - const uint8_t enableRenderConfig #ifdef SPLIT_REND_WITH_HEAD_ROT - , + const uint8_t enableRenderConfig, const SPLIT_REND_WRAPPER *pSplitRendWrapper +#else + const uint8_t enableRenderConfig #endif ) { @@ -3250,6 +3228,7 @@ static DecoderDummy *initDecoderDummy( } } #endif + decDummy->hEFAPdata = NULL; decDummy->hCrendWrapper = NULL; decDummy->hHrtfTD = NULL; @@ -3257,6 +3236,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hoa_dec_mtx = NULL; decDummy->hVBAPdata = NULL; // note: not used at the moment decDummy->hMasa = NULL; + #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) { @@ -3265,6 +3245,7 @@ static DecoderDummy *initDecoderDummy( #else decDummy->hDiracDecBin = NULL; #endif + decDummy->hDirACRend = NULL; decDummy->hSpatParamRendCom = NULL; decDummy->hQMetaData = NULL; @@ -3425,10 +3406,12 @@ static void freeDecoderDummy( } free( pDecDummy->hHeadTrackData ); } + if ( pDecDummy->hExtOrientationData != NULL ) { free( pDecDummy->hExtOrientationData ); } + if ( pDecDummy->hCombinedOrientationData != NULL ) { free( pDecDummy->hCombinedOrientationData ); @@ -4352,14 +4335,9 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( * set for the MC input. */ inputMc->customLsInput = makeCustomLsSetup( layout ); - inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, - inputMc->customLsInput, - hIvasRend->outputConfig, - *inputMc->base.ctx.pCustomLsOut ); + inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut ); - if ( ( error = initEfap( &inputMc->efapInWrapper, - inputMc->base.inConfig, - &inputMc->customLsInput ) ) != IVAS_ERR_OK ) + if ( ( error = initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ) ) != IVAS_ERR_OK ) { return error; } @@ -4811,6 +4789,7 @@ ivas_error IVAS_REND_FeedInputAudio( { return error; } + if ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) { numInputChannels = (int16_t) hIvasRend->inputsIsm[0].total_num_objects; @@ -5182,9 +5161,10 @@ ivas_error IVAS_REND_SetHeadRotation( const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_ROT_AXIS rot_axis, + const IVAS_SPLIT_REND_ROT_AXIS rot_axis, /* i : external control for rotation axis for split rendering */ #endif - const int16_t sf_idx ) + const int16_t sf_idx /* i : subframe index */ +) { int16_t i; IVAS_QUATERNION rotQuat; @@ -5204,17 +5184,15 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.headRotEnabled = 1; - /* reconfigure binaural rendering to allocate - the necessary renderers and free unused ones */ + /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { - initMcBinauralRendering( &hIvasRend->inputsMc[i], - hIvasRend->inputsMc[i].base.inConfig, - hIvasRend->outputConfig, - hIvasRend->hRendererConfig, - TRUE ); + if ( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ) != IVAS_ERR_OK ) + { + return error; + } } } @@ -5254,6 +5232,7 @@ ivas_error IVAS_REND_DisableHeadRotation( ) { int16_t i; + ivas_error error; /* Validate function arguments */ if ( hIvasRend == NULL ) @@ -5263,19 +5242,18 @@ ivas_error IVAS_REND_DisableHeadRotation( hIvasRend->headRotData.headRotEnabled = 0; - /* reconfigure binaural rendering to allocate - the necessary renderers and free unused ones */ + /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { - initMcBinauralRendering( &hIvasRend->inputsMc[i], - hIvasRend->inputsMc[i].base.inConfig, - hIvasRend->outputConfig, - hIvasRend->hRendererConfig, - TRUE ); + if ( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ) != IVAS_ERR_OK ) + { + + return error; + } } } } @@ -5639,7 +5617,6 @@ static ivas_error rotateFrameMc( ivas_error error; push_wmops( "rotateFrameMc" ); - if ( ( error = chooseCrossfade( headRotData, &crossfade ) ) != IVAS_ERR_OK ) { return error; @@ -5752,7 +5729,6 @@ static ivas_error rotateFrameMc( } pop_wmops(); - return IVAS_ERR_OK; } @@ -6593,7 +6569,6 @@ static ivas_error renderMcToBinaural( } push_wmops( "renderMcToBinaural" ); - inConfig = mcInput->base.inConfig; hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; @@ -6629,13 +6604,11 @@ static ivas_error renderMcToBinaural( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, #ifdef SPLIT_REND_WITH_HEAD_ROT - mcInput->rot_gains_prev[0], + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev[0], mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) #else - mcInput->rot_gains_prev, + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) #endif - mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -6674,7 +6647,6 @@ static ivas_error renderMcToBinaural( } pop_wmops(); - return IVAS_ERR_OK; } @@ -6700,7 +6672,6 @@ static ivas_error renderMcToBinauralRoom( } push_wmops( "renderMcToBinauralRoom" ); - inConfig = mcInput->base.inConfig; hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; @@ -6780,7 +6751,6 @@ static ivas_error renderMcToBinauralRoom( } pop_wmops(); - return IVAS_ERR_OK; } @@ -6803,7 +6773,6 @@ static ivas_error renderMcCustomLsToBinauralRoom( int16_t subframe_idx; push_wmops( "renderMcCustomLsToBinauralRoom" ); - tmpRotBuffer = outAudio; /* avoid compilation warning */ for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) @@ -6893,7 +6862,6 @@ static ivas_error renderMcCustomLsToBinauralRoom( free( tmpMcBuffer.data ); pop_wmops(); - return IVAS_ERR_OK; } @@ -6906,7 +6874,6 @@ static void renderMcToMc( IVAS_REND_AudioBuffer inAudio; push_wmops( "renderMcToMc" ); - inAudio = mcInput->base.inputBuffer; for ( i = 0; i < inAudio.config.numChannels; ++i ) @@ -6915,7 +6882,6 @@ static void renderMcToMc( } pop_wmops(); - return; } @@ -6928,7 +6894,6 @@ static void renderMcToSba( IVAS_REND_AudioBuffer inAudio; push_wmops( "renderMcToSba" ); - inAudio = mcInput->base.inputBuffer; for ( i = 0; i < inAudio.config.numChannels; ++i ) @@ -6937,7 +6902,6 @@ static void renderMcToSba( } pop_wmops(); - return; } @@ -6949,7 +6913,6 @@ static void renderMcToMasa( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; push_wmops( "renderMcToMasa" ); - copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); ivas_mcmasa_ana( mcInput->hMcMasa, tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); @@ -6957,7 +6920,6 @@ static void renderMcToMasa( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); pop_wmops(); - return; } @@ -6983,7 +6945,6 @@ static ivas_error renderMcToSplitBinaural( COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; push_wmops( "renderMcToSplitBinaural" ); - inConfig = mcInput->base.inConfig; output_frame = mcInput->base.inputBuffer.config.numSamplesPerChannel; @@ -7055,8 +7016,7 @@ static ivas_error renderMcToSplitBinaural( #endif /* Render */ - if ( ( error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &mcInput->tdRendWrapper : &mcInput->splitTdRendWrappers[pos_idx - 1], mcInput->base.inConfig, &mcInput->customLsInput, &pCombinedOrientationDataLocal, - NULL, mcInput->hReverb, 0, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &mcInput->tdRendWrapper : &mcInput->splitTdRendWrappers[pos_idx - 1], mcInput->base.inConfig, &mcInput->customLsInput, &pCombinedOrientationDataLocal, NULL, mcInput->hReverb, 0, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -7081,13 +7041,7 @@ static ivas_error renderMcToSplitBinaural( /* perform rotation in source format to tmpRotBuffer */ pCombinedOrientationDataLocal = &combinedOrientationDataLocal; - if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, &pCombinedOrientationDataLocal, -#ifdef SPLIT_REND_WITH_HEAD_ROT - mcInput->rot_gains_prev[pos_idx], -#else - mcInput->rot_gains_prev, -#endif - mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, &pCombinedOrientationDataLocal, mcInput->rot_gains_prev[pos_idx], mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -7095,12 +7049,7 @@ static ivas_error renderMcToSplitBinaural( copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); /* call CREND (rotation already performed) */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &mcInput->base.inputBuffer, *mcInput->base.ctx.pOutSampleRate ), -#ifdef SPLIT_REND_WITH_HEAD_ROT - pos_idx -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &mcInput->base.inputBuffer, *mcInput->base.ctx.pOutSampleRate ), pos_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -7132,7 +7081,6 @@ static ivas_error renderMcToSplitBinaural( accumulate2dArrayToBuffer( tmpSplitBinauralBuffer, &outAudio ); pop_wmops(); - return IVAS_ERR_OK; } #endif @@ -7157,10 +7105,7 @@ static ivas_error renderInputMc( mcInput->base.numNewSamplesPerChannel = 0; /* Apply input gain to new audio */ - v_multc( inAudio.data, - mcInput->base.gain, - inAudio.data, - inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + v_multc( inAudio.data, mcInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); switch ( getAudioConfigType( outConfig ) ) { @@ -7242,7 +7187,6 @@ static void renderSbaToMc( IVAS_REND_AudioBuffer inAudio; push_wmops( "renderSbaToMc" ); - inAudio = sbaInput->base.inputBuffer; for ( i = 0; i < inAudio.config.numChannels; ++i ) @@ -7251,7 +7195,6 @@ static void renderSbaToMc( } pop_wmops(); - return; } @@ -7264,7 +7207,6 @@ static void renderSbaToSba( IVAS_REND_AudioBuffer inAudio; push_wmops( "renderSbaToSba" ); - inAudio = sbaInput->base.inputBuffer; for ( i = 0; i < inAudio.config.numChannels; ++i ) @@ -7273,7 +7215,6 @@ static void renderSbaToSba( } pop_wmops(); - return; } @@ -7289,7 +7230,6 @@ static ivas_error splitBinLc3plusDecode( int32_t lc3plusBitrateId, lc3plusBitstreamSize; push_wmops( "splitBinLc3plusDecode" ); - assert( hSplitBin->hLc3plusDec != NULL ); /* Find next byte boundary */ @@ -7312,7 +7252,6 @@ static ivas_error splitBinLc3plusDecode( } pop_wmops(); - return IVAS_ERR_OK; } @@ -7572,7 +7511,6 @@ static ivas_error renderSplitBinauralWithPostRot( accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); pop_wmops(); - return error; } @@ -7652,11 +7590,7 @@ static ivas_error renderSbaToMultiBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &sbaInput->base.inputBuffer, *sbaInput->base.ctx.pOutSampleRate ), -#ifdef SPLIT_REND_WITH_HEAD_ROT - pos_idx -#endif - ) ) != IVAS_ERR_OK ) + getNumSubframesInBuffer( &sbaInput->base.inputBuffer, *sbaInput->base.ctx.pOutSampleRate ), pos_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -7737,7 +7671,6 @@ static ivas_error renderSbaToSplitBinaural( } pop_wmops(); - return error; } #endif @@ -7758,7 +7691,6 @@ static ivas_error renderSbaToBinaural( int16_t subframe_idx; push_wmops( "renderSbaToBinaural" ); - #ifdef SPLIT_REND_WITH_HEAD_ROT if ( sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { @@ -7839,7 +7771,6 @@ static ivas_error renderSbaToBinaural( } pop_wmops(); - return IVAS_ERR_OK; } @@ -7862,7 +7793,6 @@ static ivas_error renderSbaToBinauralRoom( int16_t subframe_idx; tmpRotBuffer = outAudio; /* avoid compilation warning */ - push_wmops( "renderSbaToBinauralRoom" ); for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) @@ -7947,7 +7877,6 @@ static ivas_error renderSbaToBinauralRoom( free( tmpMcBuffer.data ); pop_wmops(); - return IVAS_ERR_OK; } @@ -7992,13 +7921,11 @@ static void renderSbaToMasa( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; push_wmops( "renderMcToMasa" ); - copyBufferTo2dArray( sbaInput->base.inputBuffer, tmpRendBuffer ); ivas_dirac_ana( sbaInput->hDirAC, tmpRendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels ); accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); pop_wmops(); - return; } @@ -8015,7 +7942,6 @@ static ivas_error renderInputSba( #endif error = IVAS_ERR_OK; - inAudio = sbaInput->base.inputBuffer; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -8031,10 +7957,7 @@ static ivas_error renderInputSba( sbaInput->base.numNewSamplesPerChannel = 0; /* Apply input gain to new audio */ - v_multc( inAudio.data, - sbaInput->base.gain, - inAudio.data, - inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + v_multc( inAudio.data, sbaInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); switch ( getAudioConfigType( outConfig ) ) { @@ -8050,11 +7973,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: - error = renderSbaToSplitBinaural( sbaInput, -#ifdef SPLIT_REND_WITH_HEAD_ROT - outConfig, -#endif - outAudio ); + error = renderSbaToSplitBinaural( sbaInput, outConfig, outAudio ); break; #endif case IVAS_AUDIO_CONFIG_BINAURAL: @@ -8231,10 +8150,11 @@ static void renderMasaToSba( static void renderMasaToBinaural( input_masa *masaInput, - IVAS_REND_AudioBuffer outAudio #ifdef SPLIT_REND_WITH_HEAD_ROT - , + IVAS_REND_AudioBuffer outAudio, const int16_t is_split_rend_mode +#else + IVAS_REND_AudioBuffer outAudio #endif ) { @@ -8444,10 +8364,7 @@ static ivas_error renderInputMasa( masaInput->base.numNewSamplesPerChannel = 0; /* Apply input gain to new audio */ - v_multc( inAudio.data, - masaInput->base.gain, - inAudio.data, - inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + v_multc( inAudio.data, masaInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); switch ( getAudioConfigType( outConfig ) ) { @@ -8688,8 +8605,8 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_SetIsmMetadataDelay( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const float sync_md_delay /* i : Ism Metadata Delay in ms to sync with audio delay */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const float sync_md_delay /* i : ISM Metadata Delay in ms to sync with audio delay */ ) { int16_t i; @@ -8707,6 +8624,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * getSamplesInternal() * @@ -8714,11 +8632,12 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( *-------------------------------------------------------------------*/ static ivas_error getSamplesInternal( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT - , + IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */, IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ +#else + IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ #endif ) { @@ -8737,8 +8656,7 @@ static ivas_error getSamplesInternal( #ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) #else @@ -8802,11 +8720,11 @@ static ivas_error getSamplesInternal( return error; } - if ( numOutChannels != outAudio.config.numChannels #ifdef SPLIT_REND_WITH_HEAD_ROT - && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( numOutChannels != outAudio.config.numChannels && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( numOutChannels != outAudio.config.numChannels ) #endif - ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } @@ -8823,10 +8741,7 @@ static ivas_error getSamplesInternal( int16_t num_poses_orig; num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses; outAudio = hIvasRend->splitRendEncBuffer; - ivas_renderSplitGetMultiBinPoseData( - &hIvasRend->hRendererConfig->split_rend_config, - &hIvasRend->splitRendWrapper.multiBinPoseData, - hIvasRend->headRotData.sr_pose_pred_axis ); + ivas_renderSplitGetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper.multiBinPoseData, hIvasRend->headRotData.sr_pose_pred_axis ); assert( num_poses_orig == hIvasRend->splitRendWrapper.multiBinPoseData.num_poses && "number of poses should not change dynamically" ); /* Clear output buffer for split rendering bitstream */ @@ -8869,7 +8784,7 @@ static ivas_error getSamplesInternal( limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif } -#else /* SPLIT_REND_WITH_HEAD_ROT */ +#else #ifndef DISABLE_LIMITER #ifdef DEBUGGING @@ -8877,7 +8792,7 @@ static ivas_error getSamplesInternal( #endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif -#endif /* SPLIT_REND_WITH_HEAD_ROT */ +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) @@ -8908,19 +8823,8 @@ static ivas_error getSamplesInternal( /* Encode split rendering bitstream */ convertBitsBufferToInternalBitsBuff( *hBits, &bits ); - if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, - hIvasRend->headRotData.headPositions[0], - hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, - hIvasRend->hRendererConfig->split_rend_config.codec, - hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), - tmpBinaural, - 1, - cldfb_in_flag, - ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -8935,7 +8839,7 @@ static ivas_error getSamplesInternal( accumulate2dArrayToBuffer( tmpBinaural_buff, &outAudio ); } } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ +#endif return IVAS_ERR_OK; } @@ -8955,7 +8859,6 @@ ivas_error IVAS_REND_GetSamples( #ifdef SPLIT_REND_WITH_HEAD_ROT return getSamplesInternal( hIvasRend, outAudio, NULL ); - #else return getSamplesInternal( hIvasRend, outAudio ); #endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 404984e285aeb3f77512d0bf2fbc46384c3a810c..06d94c6caed7a068257a7ef17a5b85a06a9312ad 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -272,12 +272,12 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ - const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ + const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ + const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_ROT_AXIS rot_axis, + const IVAS_SPLIT_REND_ROT_AXIS rot_axis, /* i : external control for rotation axis for split rendering*/ #endif - const int16_t sf_idx + const int16_t sf_idx /* i : subframe index */ ); /* Head rotation becomes enabled by calling IVAS_REND_SetHeadRotation. Use this to disable. */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 727225a398f03e8f8d279fc1e1f725f2ebe97ec4..29027ae99be2a882321aa35d01b0e774ca4ef2ee 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2874,6 +2874,7 @@ ivas_error RenderConfigReader_getDirectivity( id[n] = last_specified_id; } + for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { idExists = false;